can we create object for static class in java
Answers were Sorted based on User's Feedback
Answer / soma414@gmail.com
yes we want create the object by using static class in java
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manjula
yes we can able to create object for the static class.. but
it is none of use.. because we can call the static class
without creating the object
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / faisal
Yes you can instantiate a static inner class and it makes sense. Internal working of hash map and hash table is based on same
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / santosh vyavhare
We can create a object of "static nested class ".
For eg. class Abc{
static class X{
void m()
System.out.println("static nested class method");
}
public static void main(String[] a)
{
X x=new X();
x.m();
}
}
but if you can not declare outer class as a static if u try to make outer class as static it will generate compile time error.
For eg static class X{}
It will generate compile time error as "Illegal modifier for the class".
| Is This Answer Correct ? | 0 Yes | 0 No |
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is the difference between the prefix and postfix forms of the ++ operator?
Write a java program to check if a number is prime or not?
i don't want fullforms of JDK an JVM i want definitions for them
What is the GregorianCalendar class?
What is the purpose of default constructor?
Is double bigger than float?
How does serialization work
where can we get jAVA project orientation traing in HYDERABD
Which arithmetic operations can result in the throwing of an arithmeticexception?
What is busy spin, and why should you use it?
How many bits does a boolean take?