Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt:Sequence of the output

 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it does, see the api declaration


http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#createNewFile()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic