Abraham Lee

Greenhorn
+ Follow
since Jan 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Abraham Lee

Here is the code:
class X {
public static void main(String[] args) {
try {
int i = (-1 >> 65535) + 1;
int j = 5/i;
System.out.println("Something");
}
catch (Exception e) { System.exit(0);
}
finally { System.out.println("Finally");}
}
}
When I have run this code nothing is displayed.
I have thought that finally method is called no mather do we have or haven't Exception.
Can someone clarify this.
Thanks
/*
class Parent{
private void method(){
System.out.println("Parent");
}
public static void main(String args[]){
Parent p=new Parent();
Child c=new Child();
Parent d;
d=c;
p.method();
c.method();
d.method();
System.out.println("c="+c+" d="+d);
}
}
class Child extends Parent{
public String method(){
System.out.println("Child");
return "result";
}
}
*/
Can someone explain how we can call c.method() without assigning return value (String) to some variable?
We can expect his result in 2 hours.
All the best Sonir !!!
We can expect his result in 2 hours.
All the best Sonir
22 years ago