explain Anonynous inner class?

Answer Posted / preetesh

An Anonymous class is an inner class that is not assigned a
name. It is defined and instantiated within arguments of a
method of the Outer Class.

Syntax is as follows:
----------------------
public class OuterClass
{
//some relevant code

methodName(new ClassName(){ }); /*It indicates compiler
that the code between the braces in the argument of the
method defines an anonymours inner class.*/
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the two types of streams offered by java 8?

502


Does java support function overloading, pointers, structures, unions or linked lists?

597


Is empty in java?

576


What is the difference between integer parseint and integer valueof?

540


What is meant by overloading?

582






What is the platform?

518


What is threaded programming and when is it used? : Java thread

524


Is string is a class in java?

513


What do you mean by platform independence? What is an interface?

558


What is an i/o filter?

559


Why are data types important?

530


What is the difference between dom and sax parser in java?

521


What is an off by one error in java?

489


What does the exclamation mark mean in java?

584


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

1666