• 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

JDCert Exam

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have any one worked on JDCert Exam. I have a question on #16. The answer is "the code does not compile". But when I tested it myself, it prints out
in test
Q16@91d8f
10
Is the answer wrong?
How can I predict the 2nd line?
class Q16
{
static int total = 10;
public static void main(String[] args)
{
new Q16();
}
public Q16()
{
System.out.println("in test");
System.out.println(this);
int temp = this.total;
if (temp > 5)
{
System.out.println(temp);
}
}
}
Thank you.
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't see any reason for the program to not compile
its perfectly alright
and hte output that u got is right
reply
    Bookmark Topic Watch Topic
  • New Topic