computer science-scanner and methods
what correctly defines and instantiates a scanner?
Scanner kb = new Scanner(in);
var must be defined as ______ when var=keyboard.next();
String
var must be defined as _______ when var=keyboard.nextLine();
String
what is a method?
a tool that helps organize a program
when writing a method you must always have an open and close what?
brace
which Graphics draws a Circle?
drawOval()
which Graphics draws a Rectangle?
drawRect()
which Graphics fills a Rectangle?
fillRect()
var must be defined as _____ when var=keyboard.nextInt();
int
which method can be used to read 'compsciisbest'? -next(), nextLine(), nextByte(), nextInt()
next() & nextLine()
what Scanner methods can be used to read in a byte?
nextByte()
what Scanner methods can be used to read in a double?
nextDouble()
which of the following methods can be used to read 52.245? -nextByte(), nextFloat(), nextInt(), nextDouble()
nextDouble() & nextFloat()
what Scanner methods can be used to read in a float?
nextFloat()
what Scanner methods can be used to read in an int?
nextInt()
which of the following methods can be used to read 65535? -nextShort(), nextInt(), nextByte()
nextInt()
what Scanner method can be used to read in a line of words?
nextLine()
what Scanner methods can be used to read in a String?
nextLine()
which method can be used to read 'computer science is best'? -nextString(), nextLine(), next(), nextInt()
nextLine()
what Scanner method can be used to read in a long?
nextLong()
what Scanner method can be used to read in a short?
nextShort()
which of the following methods can be used to read 32760? -nextShort(), nextInt(), nextByte()
nextShort() & nextInt()
which Graphics sets a Color?
setColor()