PACKAGE IMPORT

B

BHARAT

Hi,
I am a amateur Jav programmer currenlty in learning phase.
I have a little problem.
I have made a package 'thing'
the code is for the package is :
package thing;

public class test
{
public static void print1()
{
System.out.println("BHARAT MEHTA I AM FUNCTION#1");

}
public static void print2()
{
System.out.println("BHARAT MEHTA I AM IN FUNCTION#2");
}
}

ANd I have made a .java file where i am importing that package:
import thing.*;
public class demo
{
public static void main(String [] args)
{
test.print1();
test.print2();
}
}

The code gives an error on compilation saying inaccessible class or
package not found.
I have also done the classpath setting for providing the location of
package to java compiler.
But its still not working.
PLease help???????????//
 
A

Andrew Thompson

BHARAT wrote:

Sub: PACKAGE IMPORT

Please do not SHOUT* at us. We are not *deaf*.
I am a amateur Jav programmer currenlty in learning phase.

A good group for beginners is comp.lang.java.help
I have a little problem.
I have made a package 'thing' ....
{
System.out.println("BHARAT MEHTA I AM FUNCTION#1");

* Again with the SHOUTING.
Try cutting back on coffee.
.....
The code gives an error on compilation saying inaccessible class or
package not found.

Please copy/paste the first lines of compile
or run-time error messages.
I have also done the classpath setting for providing the location of
package to java compiler.

That is (probably) not the problem here.
But its still not working.
PLease help???????????//

Please fix that sticky '?' key, then immediately
work through this example of using classes in
(and out of) packages.

<http://rabbitbrush.frazmtn.com/classpath.html>

Does that fix it, for you?

Andrew T.
 
L

Lew

Class names should begin with an upper-case letter, have each word part begin
with an upper-case letter, and otherwise comprise lower-case letters.

For example:

class Test
class HasALongerName

- Lew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top