Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

explain how this code works

  Asked By: Leona    Date: May 18    Category: Java    Views: 588
  

pls look at the code and output.can anyone explain y the output is like
this with the 2 questions below...
1.class Test{
public static void main(String []args){
int i=10;
i=++i;
i=i++;
System.out.println(i);
}
}
output: 11
2.class Test{
static string raid(){
try{
throw new
Exception();
}catch(Exception e){
int i=1/0;
return "Error"
}finally{
return "peace"
}
}
public static void main(String args[]){
System.out.println(raid());
}
}
output is : "peace"

can anyone explain the reason....thanks in advance.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on explain how this code works Or get search suggestion and latest updates.




Tagged: