aspose file tools*
The moose likes Beginning Java and the fly likes out.print( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "out.print("hi");;" Watch "out.print("hi");;" New topic
Author

out.print("hi");;

pippiri venu
Greenhorn

Joined: Apr 19, 2005
Posts: 8
out.print("hi");;

hi,
can u tell me
here why this one is not giving err? (i used ;



venu gopal p
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
correct, i too noticed this lately. the reason is that perhaps, after reading the ";" the compiler looks for the next statement which can be a blank statement ending in ";" so its okay.
pippiri venu
Greenhorn

Joined: Apr 19, 2005
Posts: 8
after reading the ";" the compiler looks for the next statement
which can be a blank statement ending in ";" so its okay.

IF IT IS TRUE THEN WHY

out.print("Hi..");fff; GIVES ERR?
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
Originally posted by pippiri venu:
after reading the ";" the compiler looks for the next statement
which can be a blank statement ending in ";" so its okay.

IF IT IS TRUE THEN WHY

out.print("Hi..");fff; GIVES ERR?


because fff; is not a valid statement in java.have u defined variable fff somewhere?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61432
    
  67

Moved to Java in General (beginner).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

It might help you to understand that Java allows you to write more than one instruction per line.
Clay Adkerson
Greenhorn

Joined: Mar 16, 2005
Posts: 27
It doesnt matter how messy your code looks (although it is best to keep it organized. As long as you have all the correct ; and correct syntax it should work. The ';' tells the program that this is the end of the command. It reads everything up to the semi-colon (starting from the last point it left off) so you could have all your code on one line if you wanted to.

As to the fff; thing the syntax must be correct.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: out.print("hi");;