quick flashcards

1
Q

How do you import the Scanner for use in Java?

A

import java.util.Scanner

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

How To make a scanner object & input a string.

A

Scanner input = new Scanner(System.in);

String name = input.nextLine()

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

How to write an object to call a method?

A
className CreateObject = new className()
nameObject.simpleMessage();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to write a method that doesn’t return any data?

A

public void methodName(DataType name)

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

What is a while loop for?

A

Allows you to execute code mutliple times using a small amount of code such as increment operators.

while (variable value) {code}

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

What are the 3 most comman java statements, and what are they used for?

A

if, switch, else,

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

What other code is used with the switch statement?

A

case, default, break

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

What are the 3 most comman java loops, and what are they used for?

A

while, for, do

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