Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

xie li

Ranch Hand
+ Follow
since Nov 30, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by xie li

static methods cannot be overriden.true or false
thank you very much!
import java.io.*;
class Base{
public static void amethod() throws FileNotFoundException{
//这里面居然也可以是空的
}
}
public class ExcepDemo extends Base{
public static void main(String argv[]){
ExcepDemo e = new ExcepDemo();
}
public static void amethod(){ } //我以为这里一定要抛出异常呢
protected ExcepDemo(){
try{
DataInputStream din = new DataInputStream(System.in);
System.out.println("Pausing");
din.readChar();
System.out.println("Continuing");
this.amethod();
}catch(IOException ioe) {}
}
}
Mutiple:
1) Compile time error caused by protected constructor
2) Compile time error caused by amethod not declaring Exception
3) Runtime error caused by amethod not declaring Exception
4) Compile and run with output of "Pausing" and "Continuing" after a key is hit
the answer is 4.
who can give me an explanation?
thank you !
o ,i know
thank u very much
public class Inc{
public static void main(String argv[]){
Inc inc = new Inc();
int i =0;
inc.fermin(i);
i = i++;
System.out.println(i);
}
void fermin(int i){
i++;
}
}
who can explain why the assignment to var i has no effect?
thank you


the outputis

b
b
bab
ba
who can explain why?

Edited by Corey McGlone: Added CODE Tags
[ January 03, 2006: Message edited by: Corey McGlone ]
i got it
thank you !
i just want to know the reason,but i can not find someone to explain the answer.so i post it .
now i know how to get the information about my problem
i know the reslut,but i cannot know how to explain.so
i post it
thank you for your suggestion!
Karthik Rajashekaran
public class Cjgreen{
public static void main(String argv[]){
Cjgreen c = new Cjgreen();
c.jgreen();

}
public void jgreen(){
int iNum =1 ;
while(iNum >0){

toffer:
for(int i = 0; i < 3; i ++){
continue toffer;
System.out.println(i);
}
}

iNum --;
}
what is the reslut?
public class SyncTest {
2 private int x;
3 private int y;
4 private d void setX( int i ) { x = i; }
5 private synchronized void setY( int i ) { y = i; }
6 public void setXY( int i ) { setX(i); setY(i); }
7 public synchronized boolean check() { return x != y; }
8 } Under which condition will check return true when called from a different class?

A. check can never return true.
B. check can return true when setXY is called by multiple threads.
C. check can return true when multiple threads call setX and setY separately.
D. check can return true only if SyncTest is changed to allow x and y to be set separately.