Unit 1 Flashcards

1
Q

Naming convention of a class

A

Upper camel case “ BonJour”

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

Writing convention of an interface

A

uppercase start and should be an adjective “Adjective”

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

Writing convention of a method

A

lower camel case “bonJour”

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

Writing convention of a variable

A

lower camel case “bonJour”

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

Writing convention of a camel case

A

all lowcase “mypack”

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

Writing convention of constants

A

ALL CAPS “BONJOUR”

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

What is main

A

a method

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

What is public

A

Access specifier (control the visibility)

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

What is static

A

To call main w/o instantiating

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

void?

A

Return type

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

args

A

name chosen for this String array

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

What is the range of a byte

A

-128 ~ 127

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

What happens when you pass the limit of a datatype

A

For into it either creates an over flow or an underflow where it goes to the maximum or or minimum number

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

int i=5;
int j=i++;
int g=5;
int k=++g;

A

j=i then i+1
g=g+1 then new g=k

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

True or False: Java gives a warning whenever a variable isn’t used.

A

True, not an error warning.

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

What is the difference between char in Java vs char in C/C++?

A

In C/C++, char is an integer type (8 bit wide). But Java uses Unicode (UTF-16) to represent them. In Java,
char is of 16 bit type.

17
Q

Vrai ou faux? You can convert double to int in java and the reverse.

A

Faux. It is an error, unlike C++ it won’t round up or down. but the reverse is true. Same thing with boolean…its not allowed.

18
Q

public class Main {
public static void main(String args[])
{
int x=2;
int y=x++*3;
System.out.println(x+” “ +y);//15.0

       }}   What's the output?
A

3 and 6

19
Q

What does ~ do ?

A

if 9,then -10

20
Q

double result= ++y*x/y;

A

the second y is the new y

21
Q

System.out.println(a+b+” “+a+b);
System.out.println(a+b+a+b);

A

19 712
38 so unless there is a string it adds

22
Q

Continue skips to the iteration and breaks skips the whole iterations

A

Try it!

23
Q
A