Grade 9 chp 5 Input in Java
Name the 3 types of comments.
// Single line Comment
/* Multi line Comment */
/** Documentation Comment */
Name the package used for InputStreamReader method
java.io e.g. import java.io.*;
Define
public – It is the keyword used to specify that the function has no restriction. It can
be used anywhere throughout the system.
static – The function does not require object creation.
void - It refers to the non- returnable type function, i.e. it does not return any
value.
Scanner class
Name the package used for Scanner method
java.util.*;
Write the syntax to create a Scanner object
Scanner in = new Scanner(System.in);
What is the significance of using the word new?
The keyword ‘new’ is used for dynamic allocation of an object for the storage of
an object.
Name some of the Delimiters in Scanner class.
Comma ( ,) fullstop (.) semi colon ( ;) whitespace
Name the default token separator.
White space
Name the method to read a character in Scanner class.
next( ).charAt(0);
e.g. char ch=in.next().charAt(0);
Name the method to read an integer value in Scanner class.
nextInt()
e.g. int ch=in.nextInt();
Name the method to read a word in Scanner class.
next();
e.g. String ch=in.next();
Difference between Testing and Debugging
Pg.113
Difference between Syntax error and Logical
Pg. 116
Name the 3 types of error
Syntax error
Logical error
Runtime error