This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes last println doesn't print anything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "last println doesn Watch "last println doesn New topic
Author

last println doesn't print anything

carlos olmos
Greenhorn

Joined: May 28, 2003
Posts: 12
Running some experiments I ended up with this code:
public class CertPrep extends Object {
static byte a;
static short b;
static char c;
static int d;
static long e;
static String s;
public static void main(String[] args) {
A a1 = new A();
A ab = new B();
B b1 = new B();
String aa = "String";
int bb = 3;
int cc= 7;
System.out.println(a+b+c+d+e+s);
System.out.println(s+a+b+c+d+e);
System.out.println(aa + bb + cc);
}
}
Why the last println System.out.println(aa + bb + cc);
prints a blank line?
I'm using java 1.3.1
Regards.
Carlos.
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
Hi Carlos
I don't know about 1.3 but in 1.4 it prints the last line as well. But I don't see any reason why the last line should not be printed in JDK 1.3 or for that matter any version till date.
[ May 30, 2003: Message edited by: Anupam Sinha ]
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
maybe the best way is to write a program.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: last println doesn't print anything
 
Similar Threads
Confused for threading ?
Abstract class..
static methods and NULL
help needed for the shift operators
Another examLab casting question