In: Computer Science
Match the following
column A column B
Comment. 1. java.util.Scanner
Wrapper 2. length
char[] myletters 3. final int x=10;
import java.io.* 4. catch
ArrayList 5.alpha
String Class 6.double
Switch 7.inputfile.close();
try 8.remove()
Constant 9.default
Keyboard Input 10.compare
The question data is as below:
Comment. 1. java.util.Scanner
Wrapper 2. length
char[] myletters 3. final int x=10;
import java.io.* 4. catch
ArrayList 5.alpha
String Class 6.double
Switch 7.inputfile.close();
try 8.remove()
Constant 9.default
Keyboard Input 10.compare
After Matching:
Keyboard Input 1. java.util.Scanner
Scanner class is used to read to imput form the keyboard.
Scanner sc = new Scanner(System.in);
String s = new sc.nextLine(); //Reading String
char[] myletters 2. length
length is the attribute used to measure the length of an array.
char[] myletters = new char[10];
int len = myletters.length;
Constant 3. final int x=0
The variable value which cannot be changed in the program once it is assigned. In java, finall variable value cannot be changed in the program.
try 4. catch
In java, the code that might throw exception is place in try blocl and if any exception is thrown then it will handled using catch black.
try{
int i=0;
int a =10/i ;
} catch(Exception e){
e.printStackTrace();
}
Wrapper 6. double
A Wrapper class is used to convert the primitive data types into its corresponding objects.
we can convert double datatype into Double class object.
double
d =
250.5
;
Double doubleobj =
new
Double(d);
import java.io.* 7.inputfile.close();
java.io package has methods to read input file and write output to a file. inputfile.close() also belongs to java.io/* package.
ArrayList 8.remove()
ArrayList class has a method remove() which is used to remove the elements in the ArrayList.
If we add pramater of index to remove() then element at index 'i' will get removed.
ArrayList<Integer> a = new ArratList<Integer>();
a.remove(2);
Switch 9. default
switch is used to compare a value against the list of values. If the given value does not match with any case in th swith, then default case will be executed.
Comment 10. compare
compare suit is used to audit and comment the changes in the document.
The only possible combination left is:
String Class 5. alpha
The only common point String class and Alpha class, both are extending Object class. i.e, String and Alpha are subclasses of Object.
If you have queries regarding this answer, please reach out through the comment section.