• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ambiguous statement

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
can anybody tell me, what is the meaning of second statement.
1.....Does not compile and
2.....Compiles but generates a compile time error
(if compile time error is there, how can a code compile)
Here is a sample below.
What will be the result of compiling the following code:
public class Test {
public static void main (String args []) {
int age;
age = age + 1;
System.out.println("The age is " + age);
}
}
Compiles and runs with no output
Compiles and runs printing out The age is 1
Compiles but generates a runtime error
Does not compile
Compiles but generates a compile time error
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct answer should be does not compile
forget about the option complies but gives complie time error
it is just to confuse you

Originally posted by shikhar:
Hi
can anybody tell me, what is the meaning of second statement.
1.....Does not compile and
2.....Compiles but generates a compile time error
(if compile time error is there, how can a code compile)
Here is a sample below.
What will be the result of compiling the following code:
public class Test {
public static void main (String args []) {
int age;
age = age + 1;
System.out.println("The age is " + age);
}
}
Compiles and runs with no output
Compiles and runs printing out The age is 1
Compiles but generates a runtime error
Does not compile
Compiles but generates a compile time error


 
reply
    Bookmark Topic Watch Topic
  • New Topic