Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

abin joy

Ranch Hand
+ Follow
since Jul 29, 2008
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 abin joy

code
----------------------

public class ThreadinArg extends Thread {

public static void main(String[] args) {
//Thread t=new Thread(new ThreadinArg());
ThreadinArg t=new ThreadinArg();
t.start();
}
public void run(){
for (int i = 0; i < 3; i++) {
System.out.println("hi");
}
}

---------------------------
code

what is the advantage in directly instantiating the thread and calling start rather passing the Thread Constuctor?
code
----------------------

public class ThreadinArg extends Thread {

public static void main(String[] args) {
//Thread t=new Thread(new ThreadinArg());
ThreadinArg t=new ThreadinArg();
t.start();
}
public void run(){
for (int i = 0; i < 3; i++) {
System.out.println("hi");
}
}

---------------------------
code

what is the advantage in directly instantiating the thread and calling start rather passing the Thread Constuctor?
consider the given code snippet

code
-------------------------------------
public class WaitTest {
public static void main(String [] args) {
System.out.print("1 ") ;
synchronized(args) {
System.out.print("2 " ) ;
try {
args.wait();
}
catch(InterruptedException e){}

}
System.out.print("3 ");
}
}

---------------------------------------------
code

Here since there are no threads to notify the main()method the statement System.out.print("3 "); never gets executed.And i cannot use the non static notify() from a static context.In this case how will I notify the main() method.
13 years ago
code
---------------------------------

class Test
{
public static void render(Shape s, Circle c)
{
System.out.println("render(Shape s, Circle c)");
}

public static void render(Circle c, Shape s)
{
System.out.println("render(Circle c, Shape s)");
}
}

----------------------------------
code

I expect this code to throw a duplicate method found compilation error?But its not throwing?I removed the arguments to both the functions and it immediatrely throws compiler error.Can anybody help me in this
[ September 10, 2008: Message edited by: abin joy ]
13 years ago
code
----------------------
case 0:
{

for (int x=10;x>5;x++)

if(x>10000000)

x=10;

break;

}
---------------------------
code

In the above given code why we have omitted the braces for the for loop even though a block of statements were there.How will the execution flow happen in this case?
13 years ago
Can anyone expalin about system classes in java?
[ September 09, 2008: Message edited by: abin joy ]
13 years ago
1)How to enable and disable assertions using eclipse?
2)How to run command line arguments using Eclipse Europa
a call to this or super should be the first line of any constructor if we are providing them?Why cant we have them anywhere in our constructor code?
13 years ago
what does the clone method in the Object class dO?
In which context we use the clone function?
13 years ago
doubt cleared
thanks a lot
13 years ago
Given

code
-------------------------
Float f2=new Float(3.14f);
System.out.println("byte="+f2.byteValue());
System.out.println("short="+f2.shortValue());
System.out.println("intt="+f2.intValue());
System.out.println("long "+f2.longValue());
}

code
----------------------------------
wat is the criteria for getting the value getting truncated to 3
All except

1)System.out.println("double "+f2.doubleValue());
2)System.out.println("float "+f2.floatValue());

truncates the value to 3
I expect f2.longValue also to behave differently rather than printing 3
13 years ago
code
--------------------------
Integer i1=1000;
Integer i2=1000;
Integer i3=10;
Integer i4=10;
if(i1!=i2) {
System.out.println("diff objects");
}
if(i3==i4{
System.out.println("same objects");
}
}

code
--------------------------
produces the output
diff objects
same objects

Why is != telling us that i1 and i2 are different objects, when = = is saying that i3 and i4 are the same object?
13 years ago
What does a protected constructor for a class mean?
13 years ago
When will a ClassCast Exception be thrown?I am not able to understand the concept of upcasting and downcasting propely.Ranchers please help...
13 years ago
code
--------------
class Alpha {
System.out.println("hi");
}
----------------

this will not compile
13 years ago