This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Comilation Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Comilation Problem" Watch "Comilation Problem" New topic

Comilation Problem

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi all,
I have a very small problem. I have 2 classes as follows

How can i solve this.

(Marilyn added code tags)
[ July 04, 2004: Message edited by: Marilyn de Queiroz ]
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9044
Are A.class and B.class in the same directory? Is that directory in your classpath?

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Vi David

Joined: Mar 13, 2004
Posts: 1
public class A{
public static void main(String args[]){
B obj = new B();
class B{
public void method(){
System.out.println("Inside this method");
Jos� Alberto Mu�iz Navarro
Ranch Hand

Joined: Oct 27, 2003
Posts: 33
Not really a solution but a workaround Have you tried not making B public and typing it in the same file as the other one? I know that would solve it, but it would depend on how you want to access B
Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
have you compiled the 'B'?

when you comple "a" it will need "b" to be compled already.

Just a thought.
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Both these files are in same directory. And i want these files in two different files as and
I believe classpath setting i have done.
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Yes i have compiled the file before compiling file. After that this error has occurerd. If possible please try compiling these two files.
Jeff Pavlocak

Joined: Apr 26, 2004
Posts: 16

Your code looked good to me, so I copied your code from the top thread and compiled it. The code compiled fine and ran fine.

Double check that your code matches exactly what is in the thread and you should be good. Or better yet, do what I did and copy it from the thread and paste it into your text editor.

Remember Java is case sensitive.

Also, you don't need to compile the file before the file. The compiler will take care of that for you.

Good luck,

Jeff Pavlocak
wood burning stoves
subject: Comilation Problem
Similar Threads
using package getting compiler error
Interface doubt
import mypack.*; (asterisk and without asterisk)
interfaces used to work on my system but now they dont :)
an unbelievable question about import!!!