• 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

Tricky Question Cont.....

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
(For Information).Just try to answer the below question.Its purely based of fundamentals.
Q)What is the Output of the program.
public class Test{
public static void main(String[] args){
int i=1234;
float f=1.0;
double d= 12.45;
System.out.println("i=" + i + " f= " + f + " d=" + d);
}
}
1) i=1234 f=1.0 d=12.45
2) Compilation Error
3) Run time Error
Regards
Prasad
------------------
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasad,
It's simple...... float should be declared as

float f = 1.0F(f) ;
Aruna
 
Prasad Ballari
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
yes it is simple, dispite of knowing the answer I did mistake while taking mock test.These small things really can fetch good score for us.
regards
Prasad
------------------
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic