Introduction to Java Flashcards

1
Q

What does OOP stand for?

A

Object Oriented Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does OOP help with?

A

OOP simplifies software development and maintenance by providing some rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In OOP languages everything is associated with?

A

classes, objects, attributes and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

a class is _______________ or generic description

A

blueprint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

a class contains?

A

general attributes or properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Objects are created from a _________

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

TRUE or FALSE…
an object represents specific attributes values that apply

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

TRUE or FALSE…
Attributes is the information stored in a method.

A

False. Attributes is the information stored within an object. It represents the data of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Method represents what…methods perform what…..

A

methods represents behaviors and perform actions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the main data types?

A

int
float
char
boolean
string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a variable?

A

a variable is used to store values in Java for later use.
example int age = 65; or String name = “Jonny”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is an array used to store?

A

multiple values in a single variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following is the correct way to code an array?

A.
String [] trees = {"oak, spruce, pine"};

B.
String trees [] = {"oak", "spruce", "pine"};

C.
String trees = {"oak", "spruce", "pine"};

D.
String [] trees = {"oak", "spruce", "pine"};
A

D.
String [] trees = {“oak”, “spruce”, “pine”};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the code needed to make this if work?

            String color = "red";
	
	if (color == "blue") {
		System.out.println("I'm sorry please pick red");
	} elseif {
		System.out.println("RED");
	}
A

elseif should look like elseif (color == “red”)
String color = “red”;

	if (color == "blue") {
		System.out.println("I'm sorry please pick red");
	} elseif (color == "red") {
		System.out.println("RED");
	}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a class?

A

a structure where we define attributes and methods, which are utilized by the objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how do you create a class?

A

use the class keyword followed by the name of the class
example class bird {

17
Q

what does the Main Method do?

A

the Main Method initiates the program.

18
Q

True or False:
Does letter case matter in java?

A

true

19
Q

does the main method come before or after the class?

A

after
the syntax should look like…..

public class MyClass {
public static void main() {
//System.out.println(“example”);
}
}

20
Q

What must the class name match?

A

the class name must match the file name.

21
Q

what is a class diagram?

A

its a blueprint of a class.

22
Q

what does a class diagram show?

A

a class diagram shows the names and attributes of the classes, relationships between classes, and sometimes the methods of the classes.

23
Q

write this code out based on the class diagram (each box will instead be a number)

  1. Store
    • name: String
    • address: String
    • Store(name:String, address: String)
  2. +open(): String
  3. +close(): void
A

class Store {
private String name;
private String address;

public Store (String name, string address) {
	//do things
}

public String open () {
	//do things
}

public void close () {
	//do things
} }
24
Q

what does class diagrams NOT do

A

class diagrams does not describe functionality.

25
Q

what is a sequence diagram?

A

a sequence diagram is a plan for how code will interact with each other and the order they will interact.