• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

doubt in "%f" and "%b"

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the result of following code

System.out.print("%f,%b",Math.PI,Math.E);

and could you please explain how the result comes from ?
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dodo

Did you try running this piece of code?

First of all it gives compilation error. I think you might want to have:

System.out.printf

and not

System.out.print

%f is used for formatting decimal numbers.
%b is used for formatting boolean values. For any non-null value, other than false, %b prints 'true' as the o/p.

Murali...
[ August 01, 2007: Message edited by: Murali Kakarla ]
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Dodo Loveme"

Did you consider to change your display name. Please co-operate to the
moderators to keep this forum friendly.

Please take a moment to change your display name.

Thanks,
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear "Dodo Loveme",

I am one of the moderators of the JavaRanch forums. Here on JavaRanch, we have a naming policy. We want the users of JavaRanch to use a real name as their display name.

Unfortunately, your name "Dodo Loveme" does not comply to the naming policy. Your name should not be an obviously fictitious, "cute" nickname. Please use a real-sounding name.

Please read the naming policy carefully and change your display name. You can change your name by editing your profile.

Please note that we are taking the naming policy seriously. If you do not change your display name, your account on JavaRanch might be deleted.

Have fun on JavaRanch,
Jesper Young - Bartender
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic