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
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

phil shea

Greenhorn
+ Follow
since Aug 24, 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 phil shea

I have a doubt regarding a static block. Here i have two classes(C1,C2).

_______________________________________________
class C1
{

static int x=10;

static
{
intx=99;
}

public static void main(String args[])
{
System.out.println("The value of x is : "+x);
}
}
_________________________________________________

class C2
{

static int x=10;

static
{
x=99;
}

public static void main(String args[])
{
System.out.println("The value of x is : "+x);
}
}

____________________________________________________

C1 produces an output of 10.
Whereas C2 produces 99.

What is exactly happening inside the static block??

-phil
So all the legacy code which has used "enum" as a variable name will not work with Java1.5 with changing the code.
16 years ago
Hi,
I have a simple problem. I have downloaded a open source java project. And i tried to "build" it using Ant tool. The build has failed. And all the errors are related to "enum" keyword saying that "cannot use the 'enum' keyword as a variable.
I want to know whether "enum" keyword has become the part of java only with java 1.5?

Regards
vijay
16 years ago
I am really not getting what is the exact question of this particular thread.

Can the main method be overloaded or overridden?

I don't really understand what anyone can achieve by overriding the main method.

We can have any number of methods with the name "main" as long as their signatures are different. But "java" is only concerned with the main with the following signature.
public static void main(String args[])
This method you can have only one in a single class. And that is the method that "java" calls when a program is executed as an application.

-phil
16 years ago
If "final" is in front of a variable then that variable value cannot be changed after initializing it.

If "final" is in front of a method, then that particular method cannot be overriden.

If "final" is in front of a class, then we cannot extend that particular class.

Correct me if i am wrong.

-phil
16 years ago
Apart from simply cloning, all mutable fields need to be made independent of this object. Just to prevent unwanted access to this object's internal state. (correct me if i am wrong)

-phil
16 years ago
I do have that.

-phil
16 years ago
HI,
I am new to Ant build tool. I am trying to use it. I have unzipped the Ant into a folder and set the ANT_HOME environment variable. Seems everything is set properly.
Now, i have only one .java file in a folder. I have copied one sample build.xml file into that folder and in command prompt when i say "ant", it's saying Usage: bla bla bla.

can anyone help me out.

-phil
16 years ago
code:
--------------------------------------------------------------------------------

public class Outerclass
{
public void amethod()
{
System.out.println("In Outerclass - amethod()");
}
class Innerclass extends Outerclass
{
public void bmethod()
{
System.out.println("In Innerclass - bmethod()");
}
public void amethod()
{
System.out.println("In Innerclass - amethod()");
}
}
public static void main(String args[])
{
Outerclass o = new Outerclass();
Outerclass.Innerclass i = new Outerclass().new Innercla();
o.amethod();
i.bmethod();
i.amethod();
}
}


The above code has been posted in this thread. I tried compiling this code. But it's not compiling. Can anyone try and let me know.

-phil
16 years ago
Someone said, in Java memory is allocated by Garbage collector. Is that true? I thought memory in java is allocated by JVM.

-phil
16 years ago
I tried javac *.java. but it still shows the same error message.

phil
16 years ago