raghu nagabandi

Ranch Hand
+ Follow
since Aug 14, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by raghu nagabandi

where the memory is allocated for static variables and methods?
normally you have to put your web application in web apps folder.
Every application conatain the structure that is,
root_project_name
under this you have to put web-inf and html files
normally you have to put your web application in web apps folder.
Every application conatain the structure that is,
root_project_name
under this you have to put web-inf and html files
normally you have to put your web application in web apps folder.
Every application conatain the structure that is,
root_project_name
under this you have to put web-inf and html files
how to find method names of a class?
but i have only x.java file, i don't have x.class file.

plaese don't use reflection packege(it needs .class file)
If all the constructors of a class are private then we can not create subclass for that class.
if it contains combinations i.e. both private and others , then we can create subclass.
Hi,

Interfaces are by dedault public and abstract.

So any where you can implement them even outside the package also
I think the output is : 5

please chech in the system once.
It is possibe. Method can retutn a exception also.

Ex:

Exception demo()
{

return new IOExcetion();
}
System.out.println("te == abc------->"+(te == abc));
In above case:
Both te and abc are same type so you will not get any comipile time error.
and both are points 2 different location so it will return false.

System.out.println("i == j------->"+(i == j));
In case of numeric comarision don't think as a address comparision.just it will compare there values whether same or not. if it is same return true otherwise false.In this case if you compare int and double value , then int is automatically promoted to double perform comparision. It means automatic type conversion is possible.

== means comparision. For normal variables or constants we can compare directly , but where as objects we can not. so in case of objects we will say == as a address comparision operator.
System.out.println("te == abc------->"+(te == abc));
System.out.println("i == j------->"+(i == j));
why java does not support operator overloading?
System.out.print(s2.y +":"+ s2.z);

Here your displaying s2.y and s2.z

Here z is a static variable, so it will not depends on instance variable. directly it will display the modified value that is 10.

where as y is the instance variable. when your serializing the y value will be stored as 0 instead of 7.so when you retrived from a file again you will get 0 not 7.

so the output is 0 10
== is means address comarision operator. s1==s2 means if both points to same location it will return true otherwise return false.In this case both s1 and s2 must be contain some relationship otherwise it will give compiletime error.

equals method is available in Object class. In object class it is defined based on == operator.
Here the return type is boolean.
s1.equals(s2) if s1 and s2 are different then it will return false , s1 and s2 are points to duifferent location then it will return false. if both points to same location it will return true. In this case we will never get compile time error.

If you want to change the behaviour of equals method you can change by overriding.
This was happened in String and Wrapper classes. In this 2 cases they override like content comparision instead of address comparision.
Interface variables are implecitly
public static final