Page 1
Java: Classes and objects Latest
Questions and Correct Answers
OOP
Ans: Object-Oriented Programming
Attributes
Ans: Characteristics in an object. For example, a car
can be red or blue
Behavior
Ans: Dependent on the object type
Three dimensions in object oriented
Ans: Identity
Attributes
Behavior
Class
Ans: Describes what an object will be. It is a blueprint,
description, definition of an object
Class syntax
, Page 2
Ans: Very beginning!
public class (name class here) {
Method
Ans: Synonymous for behavior
Coding def: a collection of statements that are grouped
together to perform an operation
Declaring a method
Ans: 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!
Java: Classes and objects Latest
Questions and Correct Answers
OOP
Ans: Object-Oriented Programming
Attributes
Ans: Characteristics in an object. For example, a car
can be red or blue
Behavior
Ans: Dependent on the object type
Three dimensions in object oriented
Ans: Identity
Attributes
Behavior
Class
Ans: Describes what an object will be. It is a blueprint,
description, definition of an object
Class syntax
, Page 2
Ans: Very beginning!
public class (name class here) {
Method
Ans: Synonymous for behavior
Coding def: a collection of statements that are grouped
together to perform an operation
Declaring a method
Ans: 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!