Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

last println doesn't print anything

 
carlos olmos
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe the best way is to write a program.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic