• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

general

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q. consider the following program
public class Test { public static void main(String args[])
{boolean a = false ; if(a=true)
System.out.println("Hello");
Else
System.out.println("Goodbye");
}
}
what is the result
A. A program produce no output terminate correctly.
B. program does not terminate.
C. prints out "Hello".
D. prints out "Goodbye".
select the most appropriate answer.
Answer is c
my confusion is the the program contains an error Else,will compiler not report about that error
thanx
kuldeep
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Kuldeep,
The "Else" in your code should be "else". In the present code,it will result in a compile error, so I guess the answer should be B.
but, if you have made a typing error, and the "Else" is actually "else", the answer should be C, as you have mentioned.
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic