This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Scanner Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Scanner Doubt" Watch "Scanner Doubt" New topic
Author

Scanner Doubt

Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509
Source: Examlab



The answer is 100,55. I dont understand why 127 3L are not included?
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952


Try this.

And scanner will stop at 3L, will not scan after that.



As we have not used s.hasNext();




SCJP 6
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9400
    
  20

Punit the second code that you gave will result in an infinite loop. Change the code like this



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
Thanks Ankit, actually I was in bit hurry, thats why I wrote that in speed.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Scanner Doubt
 
jQuery in Action, 3rd edition