ACTUAL Exam Questions and CORRECT
Answers
OOP - CORRECT ANSWER - Object-Oriented Programming
Attributes - CORRECT ANSWER - Characteristics in an object. For example, a car can be
red or blue
Behavior - CORRECT ANSWER - Dependent on the object type
Three dimensions in object oriented - CORRECT ANSWER - Identity
Attributes
Behavior
Class - CORRECT ANSWER - Describes what an object will be. It is a blueprint,
description, definition of an object
Class syntax - CORRECT ANSWER - Very beginning!
public class (name class here) {
Method - CORRECT ANSWER - Synonymous for behavior
Coding def: a collection of statements that are grouped together to perform an operation
Declaring a method - CORRECT ANSWER - class Myclass{
static void sayHello(){
, //sayHello is the method
System.out.println("Hello World!")
}
public static void main (String [ ] args) {
sayHello();
sayHello();
sayHello();
}
}
/* output:
Hello World!
Hello World!
Hello World!
*/
code reuse - CORRECT ANSWER - You can write a method once, and use it multiple
times, without having to rewrite the code each time
Return value syntax - CORRECT ANSWER - class MyClass {
static int sum(int val1, int val2) {
return val1 + val2;
}
public static void main(String[ ] args) {
int x = sum(2, 5);
System.out.println(x);