Java Basics Flashcards

(43 cards)

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

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
con.println (); vs con.print("something");
println -- cursor goes to next line print -- cursor stays on same line
26
Function of Keyboard Input Command
tells computer to read integer/double/string data from the keyboard AND put data into the variable
27
Write an example of Keyboard Input Command
intVariable = con.readInt(); or dblVariable = con.readDouble(); or strVariable = con.readLine();
28
Where is the data of variables stored?
in RAM
29
Function of CPU Math Command
- 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
Function of %
Modulus sign - does integer division but takes remainder
31
Data type that holds real number data
double
32
double
Data type that holds real number data
33
Symbol for Comments
//
34
Purpose for Writing Comments
- organize code - explain complex thought processes - communitcate with team member reading your code - understand what a part of code does when revisiting it
35
Unit of measurement of angles in trigonometry calculations in Java
radians
36
String
data type which holds words, letters, punctuation, and numbers note: cannot do math with numbers
37
Write an example of setting variables as string data
String strVariable;
38
Write an example of setting variables as integer data
int intVariable;
39
Write an example of setting variables as double data
double dblVariable;
40
Math.min
compares two numbers and gets smallest
41
Math.max
compares two numbers and gets the biggest
42
Math.round
rounds to nearest decimal point
43
Math.toRadians
converts degree --> radians