they asked class A{}
class B{}
class c{}
all the three class saved as a single file,there is no main
method in the file
and anothe class
M.java
class m
{
psvm(String args[])
{
// here the parent class can access
}
}
Answers were Sorted based on User's Feedback
Answer / suresh
Yes. You can call parent classes ( i.e A or B or C) inside
of class M by instantiate and invoke methods. If parent
classes have static methods you can directly access without
instantiating.
Is This Answer Correct ? | 1 Yes | 0 No |
What is replaceall in java?
Why are constructors used?
adapter class ?
What is the covariant return type?
Explain the importance of finally block in java?
public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod
wat is final...? wat is finally...? wat is finalize....? difference between " final and finally and finalize "...?
Give some features of interface?
Why do we create public static method in java?
How infinite loop is declared?
What is final modifier?
What is meant by javabeans?