• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static char doesnt display in System.out.println()

 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,



doesnt give any thing and blocks all next statements from displaying

while,



returns 0 // this is ok
Why is this so ?

Bye & Regards,
Praveen

[ August 02, 2006: Message edited by: praveen babu ]
[ August 02, 2006: Message edited by: praveen babu ]
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you did not init. c variable and the default value is '\u0000' (invisible).
 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If default value is invisible then how come it took part in the arithmetic
calculation in the next code and why is it blocking code below it to display. Please can you clarify ?

Regards,
Praveen
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
15.18.2 Additive Operators (+ and -) for Numeric Types

Binary numeric promotion is performed on the operands (�5.6.2). The type of an additive expression on numeric operands is the promoted type of its operands. If this promoted type is int or long, then integer arithmetic is performed; if this promoted type is float or double, then floating-point arithmetic is performed.


"a + c" will be an int '0'.
[ August 02, 2006: Message edited by: wise owen ]
 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks Wise for your reply,

-Now i know why the final output is 0.
-Is the compiler unable to display the '\u0000' (invisible) char ? Is this the reason why it doesnt print lines after it
for example,



In the above code hello is not printed.

Please clarify,

Regards,
Praveen
[ August 02, 2006: Message edited by: praveen babu ]
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Window XP and Java 5.0. Your code printed out a rectang graphics and Hello string.
 
Praveen Babu
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi wise,

Thanks you. Actually i am compiling it from an editor(Edit plus) which is not displaying it.From command line iam able to see hello.

Thank You & Regards,

Praveen
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic