• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it possible to print without using System.out.println()

 
kotha vijaybabu
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers
i have a doubt regarding can we print something on the screen
without using System.out.println();

thanx for replies

vijay
[ May 02, 2006: Message edited by: kotha vijaybabu ]
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about System.out.print or System.err.println?

Please define your content. What exactly do you mean by "print something on the screen"? Why are you asking this question? What problem are you trying to solve?
 
kotha vijaybabu
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jeff,
i mean to ask that is there anotherway to print something without using
System.out.println()
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends. Why are you asking this question? What problem are you trying to solve?
 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kotha vijaybabu:
hi Jeff,
i mean to ask that is there anotherway to print something without using
System.out.println()


System.out is merely a static variable holding a print stream to a file output stream to the stdout file descriptor.

I guess you can do something like this...



But why?!?!?

Henry
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But why?!?!?
[/QB]


We won't know until the original poster tells us why he is asking this question -- What problem is he trying to solve?
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe he just doesn't like typing so many words to print? Sometimes when I'm writing some prototype code and doing a lot of debug printing I do this:

and then just use out.println().
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats bad A yuriy,

ima member that for life lol...

didn't know you could do that..

it really is the small things that make the difference.

-Justin-
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yuriy Zilbergleyt:
Maybe he just doesn't like typing so many words to print?


That is why the programming gods gave us macros.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48938
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a quicker was to use "out," which only works on J5.0, namely the static import.

You should only use static import for static members you use frequently, and shouldn't import a lot of classes, otherwise you can get confused about where the members come from.

CR
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... we may never know if we answered the original poster's question...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic