Question: Consider the Java segment: String line 1 = new String ( c = 1 + 2 + 3 ) ; StringTokenizer tok =

Consider the Java segment:
String line1= new String("c =1+2+3") ;
StringTokenizer tok = new StringTokenizer(line1,"+=");
String foo = tok.nextToken();
String bar = tok.nextToken();
The values of foo and bar are:
foo is c , bar is =.
foo is c, bar is .
foo is =, bar is +.
foo is c , bar is 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!