Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Package help for a newbie

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Package help for a newbie

    Hey everyone I just started a java programming course and I have no prior programming experience. The course seems to be aimed at people with prior experience in other languages so I'm a bit over my head I think. First obstacle I've hit is packages. I'm a bit confused as to how to save a package in a directory.
    //this is a simple Java application
     
    package examples.basics;
     
    public class FirstApp {
     
    public static void main (String args[]) {
    System.out.println("Your first Java application");
    }
    }
    This is the first bit of coding, I have saved/compiled and ran it without the "package examples.basics;" as instructed in the course ~But once I add the package to it how exactly do I save it in a directory? Does that package line turn all that code into a package of that name? Do I save that as is, compile it and run it under a different name? I know its basic stuff but the directory business has thrown me off and its not gettin through my thick skull. Be very glad if anyone could explain it to me. Sorry if I'm wasting your time by being an idiot lol.


  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Package help for a newbie

    Think I have it lol. The course works explanation of how to run it was to type. java examples.basics.FirstAppPackage. I didnt realise it didnt mean for me to type "Package" onto the end of it. Dont know why it added it though. Just to confuse people like me maybe. I thought it was the directory path that was messin it up. Apologies for bothering you guys, and have a fine evening.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Package help for a newbie

    Hello Skunkle,

    Welcome to the Java Programmming Forums.

    I am glad you have solved your issue.
    It may be worth reading - Lesson: Packages (The Java™ Tutorials > Learning the Java Language)
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    Junior Member
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Package help for a newbie

    Thanks, I'll use those Tutorials along with the coursework. Might get me through with a bit more understanding.

Similar Threads

  1. Package confusion
    By caesius in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 21st, 2011, 11:08 PM
  2. Is it possible to package Java
    By UnderWater2 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 2nd, 2010, 01:31 AM
  3. creating a package
    By x3rubiachica3x in forum Object Oriented Programming
    Replies: 6
    Last Post: September 26th, 2010, 11:10 PM
  4. Accessing Package from a Different Directory
    By rameshiit19 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 15th, 2010, 11:39 PM
  5. [SOLVED] Finding acm package
    By javapenguin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 12th, 2010, 11:50 AM