1: Quizzes Flashcards
What is the correct method signature for the ‘main’ method used to allow a Java class to serve as a stand-along program?
public static void main(String[] args)
When you compile a java program, what is produced?
Object code, which is also called bytecode. (.class file)
When you compile a java program, what kind of file is produced?
A .class file.
All java programming language statements must end with what?
A semicolon ;
You have just written a program that compiles and runs without showing any error messages. However, it does not produce the correct results. What kind of error do you have?
A logic error.
What is the mechanism used in the second line of code below that allows a programmer to force a potentially unsafe conversion between data types?
double size = 4.67;
int s = (int)size;
A cast
Name 10 Java keywords
public, class, static, void, boolean, char, double, else, final, float, for, if, import, int, long, new, package, private, return, short, throw, throws, while
What type of characters are used to define the beginning and end of a Java block, such as a class or method definition?
Curly braces { }
Name three important characteristics of a class name.
- For good style, it should be capitalized.
- It must match the name of the file where it is stored.
- It must be one word (no spaces).
The process of breaking a large programming task down into a series of smaller ones is called…
Procedural decomposition.
The process of breaking a large programming task down into a series of smaller ones is called…
Procedural decomposition.
What is the correct syntax for a method header with parameters?
public static int example(int x, int y) {
What is the term when you have 2 methods in a class with the same name, but different parameter lists?
Method overloading
What is the keyword used to indicate that a method returns no value?
void
What is the name of the package that contains Scanner?
java.util