Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Is it possible to write method inside method

Answers were Sorted based on User's Feedback



Is it possible to write method inside method..

Answer / divya

no,it's not possible to write method inside a method.it
will gives an error illigal starts of expression

Is This Answer Correct ?    18 Yes 4 No

Is it possible to write method inside method..

Answer / janeesh

it is possible to write a method inside a method by using
method local inner classes.
Eg:
class Outer {


public void display() {
System.out.println("This is outerclass method.");

class Inner{

public void displayInner()
{
System.out.println("innerclass method");
}

}
Inner objC = new Inner();
objC.displayInner();
}
}
class MethodeInsideMethod {
public static void main(String[] args) {
Outer objC = new Outer();
objC.display();
}

}


Output:
This is outerclass method.
innerclass method

Is This Answer Correct ?    11 Yes 5 No

Is it possible to write method inside method..

Answer / mitul

Answer #2 is correct

Is This Answer Correct ?    7 Yes 1 No

Is it possible to write method inside method..

Answer / umesh

Answer #2 is wrong

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Core Java Interview Questions

What is foreach loop in java?

0 Answers  


What is the disadvantage of java?

0 Answers  


What are data types in oop?

0 Answers  


what is Assertion?

4 Answers   Wipro,


What is super?

0 Answers  


What is the difference between the size and capacity of a vector?

0 Answers  


What is difference between this and super keyword?

0 Answers  


What is the use of static keyword in "public static void main()"

10 Answers   College School Exams Tests, Infosys, Six Dee Telecom,


What are the approaches that you will follow for making a program very efficient?

0 Answers  


class a extends b { } class b extends a { } why java doesn't support cyclic pls explain me with example

3 Answers   Wipro,


Why can't we make jsp as a controller and action servlet in struts?

8 Answers   TCS, Wipro,


Explain java coding standards for variables ?

0 Answers  


Categories