• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

stange problem

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there are 2 classes demo and demo.when i compile demo1 class it gives compiler error: cannot resolve symbol demo.
can some1 explain me this strange behaviour.
class demo
{
demo()
{
System.out.print("demo");
}

}
class demo1 extends demo
{
demo1()
{
System.out.print("demo1");
}
public static void main(String args[])
{
demo d=new demo();//1 compiler errorr
}
}

Thanx in advance
Rgds,
Arpana
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither classes belong to a package, so they will need to be in the same folder to compile.
 
Arpana Rai
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I kept them in the package Arps even then its giving the same kinda error.
package Arps;
class demo1 extends demo
{
demo1()
{
System.out.print("demo1");
}
Static demo d;
public static void main(String args[])
{
d=new demo();
}
}
-----------------------------------
package Arps;
public class demo
{
public demo()
{
System.out.print("demo");
}
public static void main(String []args)
{
demo d=new demo();
}
}

rgds,
Arpana
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure the demo class is stored in a source file named demo.java. If you named it Demo.java, for example, the compiler will not find it--it looks for "demo.java."
The generally accepted Java style convention is to name classes starting with uppercase letters. Instead of "demo" please use "Demo."
-Jeff-
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and you need a folder Arps;
but packages should be in lowercase letters, so call it 'arps'.
Put you java into that arps-folder.
compile it from above:
javac arps/Demo.java
and use the [ code ] button when posting code.
[ April 01, 2004: Message edited by: Stefan Wagner ]
 
Arpana Rai
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


package arps;

class Demo
{
public Demo()
{
System.out.print("Demo");
}
public static void main(String []args)
{
Demo d=new Demo();
}
}



package arps;
class Demo1
{
static Demo d;
Demo1()
{
System.out.print("Demo1");
}
public static void main(String args[])
{
d=new
Demo();
}
}


I followed all the above instructions.When i compile the demo class it gives error that "cannot read arps/Demo.java.
Is there any classpath problem???
rgds,
Arpana
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I feel it is classpath problem.Be in the package just before the arps
package ie c:arpana/arps/....be in the arpana pack and compile with arps.demo.java
[ April 01, 2004: Message edited by: red bull ]
 
Arpana Rai
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It still giving the same kinda error.
 
jamma jacob
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Arpana
Try this, take away u r class path settings put the java files in bin folder and compile.So we can check whether its a class path problem
 
Arpana Rai
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I unset the CLASSPATH variable.now its working.
thanx bull
rgds,
Arpana
 
jamma jacob
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Arpana
It wasn't a strange problem



rgrds
red bull
 
reply
    Bookmark Topic Watch Topic
  • New Topic