Java Basics Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is it important to note with brackets?

A

For ever open bracket ( { [ …
There is a close bracket ) } ]

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

Write the skeleton/framework

A

import arc.*;

public class -name-{
public static void main(String [] args){
Console con = new Console();

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

Location of Import Commands

A

top of the program

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

Function of Import Command

A

to import different programming libraries

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

What do Libraries give?

A

access to specific Java commands

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

to import different programming libraries

A

Function of Import Command

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

Write the import command for the arc library.

A

import arc.*;

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

Function of this command:

import arc.*:

A

imports the arc library

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

Function of this command:

public class javabasics2{

}

A

title of the java program

note: the title needs to match the saved file title exactly

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

Notes about the title:

A

no spaces
cannot start with a number
no special characters

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

What file extension name should you save your programs under?

A

.java

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

Function of this command:

public static void main(String[] args){

}

A

represents the main method of the java program

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

What do all Java programs have?

A

a public static void main

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

Function of this command:

Console con = new Console();

A

provides Console window

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

Function of Console window

A

number and text input
text or graphics output

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

Function of RAM Command

A

Tells RAM to reserves space for future data

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

Tells RAM to reserves space for future data

A

Function of RAM Command

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

number and text input
text or graphics output

A

Function of Console Window

19
Q

Write the code which provides a console window.

A

Console con = new Console ();

20
Q

Write the command which provides the main method of the program.

A

public static void main(String [] args){

}

21
Q

Data type that holds integer data

A

int

22
Q

int

A

data type that holds integer data

23
Q

Function of GPU/Monitor Output Command

A

tells computer to print whatever is in quotes to the screen + data in variables

24
Q

Write an example of GPU/Monitor Command

A

con.println(“example”);

or

con.print(“example”);

or

con.println(“example” + intVariable);

25
Q

con.println (); vs con.print(“something”);

A

println – cursor goes to next line
print – cursor stays on same line

26
Q

Function of Keyboard Input Command

A

tells computer to read integer/double/string data from the keyboard AND put data into the variable

27
Q

Write an example of Keyboard Input Command

A

intVariable = con.readInt();
or
dblVariable = con.readDouble();
or
strVariable = con.readLine();

28
Q

Where is the data of variables stored?

A

in RAM

29
Q

Function of CPU Math Command

A
  • tells CPU to perform calculations on the r.h.s. of the ‘=’
  • puts results into variable on l.h.s. of the equal sign
30
Q

Function of %

A

Modulus sign - does integer division but takes remainder

31
Q

Data type that holds real number data

A

double

32
Q

double

A

Data type that holds real number data

33
Q

Symbol for Comments

A

//

34
Q

Purpose for Writing Comments

A
  • organize code
  • explain complex thought processes
  • communitcate with team member reading your code
  • understand what a part of code does when revisiting it
35
Q

Unit of measurement of angles in trigonometry calculations in Java

A

radians

36
Q

String

A

data type which holds words, letters, punctuation, and numbers

note: cannot do math with numbers

37
Q

Write an example of setting variables as string data

A

String strVariable;

38
Q

Write an example of setting variables as integer data

A

int intVariable;

39
Q

Write an example of setting variables as double data

A

double dblVariable;

40
Q

Math.min

A

compares two numbers and gets smallest

41
Q

Math.max

A

compares two numbers and gets the biggest

42
Q

Math.round

A

rounds to nearest decimal point

43
Q

Math.toRadians

A

converts degree –> radians