Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Package error Help ???????

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm wrote this code create package
package use;
public class MyClass1
{
public int A=0;
public MyClass1()
{
A=0;
}
public MyClass1(int b)
{
A=b;
}
public void setInts(int b)
{
A=b;
}
public int getInts()
{
return A;
}
}
this code is calling getInts method
import use.*;
import java.lang.*;
public class aaaa
{
public static void main(String args[])
{
MyClass1 a=new MyClass1(100);
int ss=a.getInts();
System.out.println(Integer.toString(ss));
}
}
but clause cannot access MyClass1 error;
how to create and use package
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dorj,
I had no problem using your stuff under JDK1.2 using WinNT. Here's what I did:
1. Created directory c:\temp\use
2. Compiled MyClass1.java into MyClass1.class and placed it into the new directory.
3. Compiled aaaa.java into aaaa.class and placed it into c:\temp directory.
4. Ran the aaaa.class program from within the c:\temp directory.
Regards,
Manfred.
 
Dorj Galaa
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic