Win a copy of Spring Boot in Practice this week in the Spring forum!

Pooja Prakash

Greenhorn
+ Follow
since Jul 01, 2009
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 Pooja Prakash

Vinayagar Karpagam wrote:Hi Karthick,

Swapping the methods in the super and sub-classes would give us a fair idea on what's happening. The code doesn't even compile.



Vinayagar. K


I compiled and ran the above code. It compiled and ran successfully.The output was Super method;

-Pooja
Hi,
Raymond's explanation is perfectly clear. I had misunderstood the explanation in K&B book but now i've got it all sorted. Thanks Raymond

Cheers,
-Pooja
Hi,

I got Karel the Robot JAR file and then wrote a program to execute certain movements by Karel Robot. But when I execute it using Eclipse I'm getting Null pointer Exception... I don't know how to resolve this. Please help.I'm attaching a screenshot(Hope it helps)

Thanks in advance.
-Pooja
13 years ago
Hi,

I'll give an example. Just think that you wanna buy a car .Here Car is a class. When you say

Car a= new Car();

the car class is instantiated.(ie you've bought the car)
Now you have specified before buying the car, that you need A/c, diesel as fuel, the colour of car, etc. All these attributes are mentioned in your 0 argument constructor. If you don't give all these details, then the store gives oyu a car with default settings.

It's the same with the constructor. If you define your own constructor, It is called when you say new Car().Otherwise, if you don't define your own constructor, you get a car with default values .(created by default constructor).

I hope you understood the concept.

-Cheers,
Pooja
13 years ago
Hi,
I ran the code through command prompt and the output had 2 lines as you say.

But....
When i ran the same code on Eclipse IDE i'm getting 3 lines of output.I'm enclosing a screenshot for clarity...
13 years ago
The .class file was there. I added "public" specifier and the program executed perfectly.Thanks a ton.
But when i tried executing it in Notepad++ it gave the exceptions i mentioned above. Is it because there's a problem in Notepad++??
As the program is working just fine in Textpad

-Thanks ,
Pooja
13 years ago
I have set the path to C:\Program Files\Java\jdk1.6.0_14\bin
I tried executing the same program in Eclipse.I'm getting the same Exceptions.THe compilation's fine.


-Pooja
13 years ago
I have the source files in C:\ (ie C drive)
I compiled it in the same directory(so the class files are in the same directory as the source)
C:\ javac Example.java
( I experienced no problems with compilation)

-Pooja
13 years ago
I wrote a basic hello world program named Example.java . It compiled perfectly.But when i typed
C:\ java Example
java.lang.NoClassDefFoundError: Example
Caused by: java.lang.ClassNotFoundException: Example
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: Example. Program will exit.


This is the problem i'm having.Someone please help.
Thanks in advance.
-Pooja
13 years ago