What is the major of difference in use for the API String cl

What is the major of difference in use for the API String class and A static field belongs to the_____and not to____ All static fields must have public access: true or false? Write a call to the static method in the Math class named cell(), static methods only have access to what type of fields? Topic: StringTokenizer class What package is the StringTokenizer class in? What is the difference between the three constructor methods of the StringTokenizer class? Name three methods of the StringTokenizer class. Suppose you have the following code: Write the code to print how many tokens are in the line of text. Write the code to print each token. What is the return type of the method nextToken().

Solution

Topic : static methods

1.

Answer:

A static field belongs to the class and not to the instances of class.

Explanation : A static field belongs to the class and not to the instances of class and it facilitates all instances of any class can access the same static field variable.

2.

Answer:

All static field must have public access.(True)

Explanation : If it can be accessed in public,it is accessible in all classes.

3. write a call to the static method in the Math class named ceil().

Answer:

class Math {

public static void main(String[] args) {

    ceil();

}

static void ceil() {

    System.out.println(\"Hello JAVA.\");

}

}

4. static methods have only access to what type of field?

Answer:

Generally static mthods access static fields.

Topic :string tokenizer class

1.What package is the string tokenizer class in ?

Answer:The string toknizer class is in java.util package.

2.What is the difference between three constructor methods in string tokenizer class?

Answer:

There are three types of constructors in a stringtokenizer class.i.e StringTokenizer(String str), StringTokenizer(String str, String delim) and StringTokenizer(String str, String delim, boolean returnValue) etc.

StringTokenizer with specified string is created by StringTokenizer(String str) constructor.StringTokenizer with specified string and delimeter is created by StringTokenizer(String str, String delim) constructor .StringTokenizer with specified string, delimeter and returnValue is created by StringTokenizer(String str, String delim, boolean returnValue) constructor .Delimiter characters are considered to be tokens, if return value is true.On the other hand delimiter characters serve to separate tokens,if it is false.

3.Name three methods of string tokenizer class?

Answer:

boolean hasMoreTokens(),String nextToken() and String nextToken(String delim) are three methods among the six methods of string tokenizer class.

Checking of more tokens available is performed by boolean hasMoreTokens() method .

The next token from the StringTokenizer object is returned by String nextToken() token.

The next token based on the delimeter is returnrd by String nextToken(String delim) token.

5.What is the return type of the method nextToken()?

Answer:

The return type of the method next token() is the next token i.e the string after the current position.

 What is the major of difference in use for the API String class and A static field belongs to the_____and not to____ All static fields must have public access:
 What is the major of difference in use for the API String class and A static field belongs to the_____and not to____ All static fields must have public access:

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site