Chapter1 Flashcards

1
Q

Name the two aspects of Java identifiers.

A

Legal identifiers

Oracle’s java code conventions

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

What does it mean to have legal identifier?

A

rules that the compilers uses to determines if the name is legal

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

What is Oracle’s Java Code Conventions

A

it is oracle’s recommendation for naming ur variables, classes and methods.

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

Name the legal identifier for naming identifiers.

A
  • Start with letter, $ or _
  • Cannot start with digits.
  • after that can have alpha numberic characters, $ or _
  • case sensitive
  • no limit to the number of characters an identifier can contain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name the 50 java keywords

A
a - abstract,assert
b- boolean, break, byte
c- char, class, case, const, catch
d- double,do, defualt
e- enum, extends, else
f- for, final, finally
g- goto, 
i - int, if, implements, import, instanceof, interace
n- navtive, new
p - private, protected, public,, package
r - return
s- switch, stringfb, super, synchronized, short
t - throws, transient, try, this
v- volatile, void
w-while
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the naming convention for interfaces?

methods?

A

Runnable
Serializable -add able
getUserName.
so camelCase

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

Can main method be over loaded?

A

Yes it can be

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

What is static import?

A

so if you do import static java.lang.System.out;
all you gotta do is
out.println(“Hello”);

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

What are the nested class?

A

inner classes

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

Name the two types of modifiers

A

access modifiers
nonaccess modifiers :
strictfp, final , abstract

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

What does it mean for a class A to have access to class B?

A

So A extends B.
create an instance of B
and A can access certain methods and variables..

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

strictfp

A

can only be used with a method or class not never with a variable.

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

Create an abstract method. Whats the difference?

A

public abstract void goFast(); //this is the difference.

public void getFast(){};

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

Good to know about abstract keyword

A

If u have a single array method, that class must be abstract

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

Will this compile?

final void bounce();

A

No because final and abstract cannot be used at once

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

Will this compile?
private void bounce()
protected void bounce()

A

interfaces methods are always public

17
Q

Will this compile?

static void bounce()

A

No because interfaces define the instance method.

18
Q

name the key rule for interface constant

A

public static final

19
Q

What are nonlocal variable?

A

instance variable

20
Q

What are members?

A

methods and instance variables

21
Q

Can you apply access modifiers to local variables?

A

no

22
Q

synchronized method

A

it can only be accessed one thread at a time

23
Q

What is the difference between arguments and parameters?

A

arguments : doStuff(“a”,2);
doStuff(String a, int 2);
so we expect a and 2.

24
Q

There are no final what only final what?

A

No final objects just final references