This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Doubt:Sequence of the output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt:Sequence of the output" Watch "Doubt:Sequence of the output" New topic
Author

Doubt:Sequence of the output

mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72


answer: false
true
true


how do we arrive at this answer shouldn't it be
false
false
true
according to the sequence in which the print statements are written?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1400
    
    6



Swastik
mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72


i understand this, but doesn't it print the value assigned to newfile , like a good compiler?? or is it that it resolves to a boolean expression?
mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72
ok.... the print statement actually does resolve into a boolean expression

and the question for the 2nd answer is -> did the createNewFile method create a new file?

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1400
    
    6

Yes it does, see the api declaration


http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#createNewFile()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt:Sequence of the output
 
Similar Threads
file Deletion
Files
Creating files using Class file
Writing a FileOutputStream into a File
[solved]what the syntax for "if file not exists"?