Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

PACKAGE IMPORT

Thread view: 
BHARAT - 02 Jan 2007 15:01 GMT
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???????????//
Andrew Thompson - 02 Jan 2007 15:50 GMT
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.
Lew - 02 Jan 2007 19:43 GMT
BHARAT wrote:
>> public class test

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.