Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


what is an anonymous class?

Answers were Sorted based on User's Feedback



what is an anonymous class?..

Answer / guru

anonymous class are inner classes that cant not have a
class name and constructor also.

Is This Answer Correct ?    6 Yes 0 No

what is an anonymous class?..

Answer / kapil dalke

anonymous class means its does not have a tag name.
as you know that...
when u declare the class
class Tcs
{
......
....
}
But its not anonymous class because it has class name(tag);
if u declare like that
class
{
............
.........
}
then its called aonymous class

Is This Answer Correct ?    7 Yes 3 No

what is an anonymous class?..

Answer / dipesh

Suppose

Class My implements InetrfaceName{

My my=new InterfaceName(){ write mehtod impl here of
interface};

here we r creating instance of class (we dont know name)to
my

Is This Answer Correct ?    3 Yes 1 No

what is an anonymous class?..

Answer / nitin kumar jha

anonymous class is a class which is defined on run time
that it;

Is This Answer Correct ?    3 Yes 1 No

what is an anonymous class?..

Answer / venki

3) Anonymous classes:
1. A class which doesn’t have any name is called anonymous class and which is a type of inner class. It can be either member class or local class.
2. It is a sub class that extends a class or implements an interface but not both. It can implement only one interface.
3. These are used where implementation of methods various from one object to another object. Anonymous class is final class.
4. public class Demo{
A a=new A();
a.m1();
A 1=new A(){ void m1(){ --- }};
a1.m1();
}
On compiling this above program the java compiler generates A.class, Demo.class and Demo$1.class (Anonymous class).

Is This Answer Correct ?    0 Yes 0 No

what is an anonymous class?..

Answer / narasimha

hi ,
look into this


Anonymous type is the type that is created anonymously.
Anonymous type is a class that is created automatically by
compiler in somewhere you can’t see directly while you are
declaring the structure of that class. Confusing? Let me
show you one example.

view plaincopy to clipboardprint?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Person _person = new Person { ID = 1, FirstName
= "Michael", LastName = "Sync" };
Console.WriteLine("Name: {0} {1}", _person.FirstName,
_person.LastName);
Console.ReadLine();
}
}
public class Person {
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer



More Core Java Interview Questions

What is the use of parseint in java?

0 Answers  


class A{ class B{ } } in which name u save the file,its the program compile?

6 Answers   HCL,


What is the use of singleton?

0 Answers  


What best practices should you follow while writing multithreaded code in java?

0 Answers  


Why constructor has no return type?

0 Answers  






How to convert string to char and vice versa?

0 Answers  


Difference between Primary key and unique key?

4 Answers  


What environment variables are required to be set on a machine in order to run Java programs?

0 Answers   Tech Mahindra,


Diff between C++ and java?

9 Answers   TCS,


How to create an instance of a class if the class has private constructor?

3 Answers  


What is string immutability?

0 Answers  


What is anagram word?

0 Answers  






Categories