This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes General Computing and the fly likes Scanner Example from K&B. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Scanner Example from K&B." Watch "Scanner Example from K&B." New topic

Scanner Example from K&B.

aruna dabas

Joined: Dec 16, 2008
Posts: 27
dear Friends Please Explain me this code.

import java.util.Scanner;
public class ScanNext{
public static void main(String args[]){
boolean b2,b;
int i;
String s,hits=" ";
Scanner s1=new Scanner(args[0]);
Scanner s2=new Scanner(args[0]);
hits += "s";
}else if(s2.hasNextBoolean()){
hits +="b";
}else{;hits +="s2";}
System.out.println("hits" +hits);

if this program is invoked with
% java ScanNext "1 true 34 hi"

it produces
hits ssssibis2

Joe Ess

Joined: Oct 29, 2001
Posts: 8836

Please do not post the same question more than once. Cross-posting causes confusion and duplication of effort as the community tries to help everyone.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Scanner Example from K&B.
Similar Threads
Tokenizing with Scanner
Tokenizing with scanner
confused about Scanner class
Scanner Example from K&B.
How to add elements from a file into an Array List