鼻涕的JAVA 1.5考試重點1

Garbage collector

System.gc();

Runtime.getRuntime().gc();

Thead

public final static int MIN_PRIORITY = 1;

public final static int MAX_PRIORITY = 10;

int xx = 2;

for(int yy=2; yy>0;System.out.println(--yy)){

System.out.println(xx+" " +yy);

xx++;

}

output:

2 2

1

3 1

0

aLiveThread is runnalbe, which three guarantee that a thread will leave the running state?

wait();

sleep(1000);

aLiveThread.join();

一個檔案只有一個public物件

The wait() method is overloaded to accept a duration

Both wait() and notify() must be called from a synchronized context

Throw by JVM

StackOverflowError

NullPointerException

NoClassDefFoundError

ArrayIndexOutOfBoundException

Throw by developer

NumberFormatException

Sleep()不會釋放鎖

assert t<4>

不能放沒有回傳String或是int,short,long等等的函式

建構子沒有回傳東西

True

Good encapsulation helps promote loose coupling.

False

A class must be well encapsulated in order to be highly cohesive.

If two classes are NOT each highly cohesive, they cant’t be loosely coupled to each other.

High cohesive allows you to change a method’s implementation without having to change its API.(talk about encapsulation)

Tight coupling helps promote low cohesion.

Map只有put()沒有add()

Listadd()沒有put()

When a thread invokes wait(), it realease its lock.

True

The java.io.BufferedReader class has a method to read a line of date at a time.

The java.io.FileRader has a read() method.

The java.io.BufferedReader class has a read() method.

A java.io.BufferedReader can be constructed with a java.io.FileReader instance.

False

A java.io.BufferedReader can be constructed with a java.io.FileReader instance.

The java.io.FileReader class has a method to read a line of date at a time.

True

JAR files placed in the /jre/lib/ext sub-directory within the J2SE directory tree be used by javac regardless of the command line classpath.

When a part of a directory tree that includes subdirectories with files is put into a JAR file, all of the files are saved in the JAR file , and the subdirectory structure is retained.

False

A JAR file can contain classes from only a single package.

JAR files can be used with the javac command but not with the java command.

In order to specify the use of JAR file on the command line, the JAR file’s name must NOT included in the classpath.

comma = 逗號

Which is true about using a DateFormat to print the value of a single Calendar object using different Locales?

True

You would use the DateFormat.format() method.

You would have to use a different DateFormat objects for each Locale you need to print.

You must convert the Calendar object to a Date object in order to send it to the DateFormat method printing.

False

You would use the DateFormat.parse() method.

You could use a single DateFormat object to handle all the Locales you need to print.

You can pass the Calendar object to the proper DateFormat method for printing.

Which can be constructed using an instance of java.io.File?

True

java.io.FileWriter

java.io.PrintWriter

java.io.FileReader

False

java.io.BufferedWriter

java.io.BufferedReader

interface Runnable{

public abstract void run();

}

Static variables are NOT serialized.

Transient variables are NOT serialized.

呼叫函式是呼叫該實體的函式

呼叫實體變數是呼叫該參考的變數

String qq = "";

String[] aa = {"-", "A", "."};

for(int x = 0; ++x <>

qq += aa[x];

System.out.println(qq);

}

java.util.ArrayList

java.util.LinkedHashSet

interface method can’t be final or static.

interface variables could be static.

True

is-a relationships always rely on inheritance.

is-a relationships always require at least two class types.

is-a relationships always rely on polymorphism.

False

is-a relationships always rely on instance variables.

is-a relationships are always tightly coupled.

沒有留言:

發佈留言