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 5 of 5

Thread: Java (Easy)

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java (Easy)

    Ok, Lets get into our first script.
    Hello world!!!!
    1. Hello World
    // Public class just helps it seem natural right now. We'll be going into just Normal Class later.
    public class HelloWorld {
        // Public static VOID main sends a string that connects each script. 
        // Pretend its a rope. Without the script the rope will lose durability. It'll all fall down so it wouldn't be usable.
        public static void main (String[] args) {
    	  //Declares a main class.
               System.out.println("Hello World");
    //displays text so you can read it.           //Try compiling this. It worked for me. If it doesn't work for you (If you dont know how to //check Java version listen up) search up JAVA in your search thing and click it. It its Java 6/7 then this should work. It may just be a //complicated error like my thing that wont show the image.
       }
    }
    2. Variables

    Ok, I'm gonna edit this lesson so you can ACTUALLY run it.
    Listen to my comments too. I'll start making videos and replace the code boxs.
    public class Pig{
      public static void main(String[] args) {
    	  //starting speech
      System.out.println("Lets add 2 Numbers!");
      //Declares Variables
      int a = 26;
      int b = 153;
      // The variable its added up in
      int sum = a + b;
      // Lets it print the sum :D
      System.out.println("Sum: " + sum);
      // Test it out!!!
      }
    }
    Last edited by ErrorBuster; May 1st, 2012 at 04:29 PM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Java (Easy)

    I'm glad you're trying to write tutorials, but those will probably do more to confuse people than help them learn. Your first code snippet contains several syntax errors, which means that the code in fact will NOT compile, despite what you indicate in the comments. Also, saying "check if your IDE or Java is working" is very unclear, especially when the problem is in fact your code. Your second code snippet provides no context for what's going on. If anybody is looking for basic tutorials, I suggest sticking with the ones written by Sun: The Java™ Tutorials
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java (Easy)

    I'm expecting people to already know the what that stuff means. Idk why it wont work. It works fine for me.

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java (Easy)

    Lol, I pasted the wrong sheets of code. Sorry Let me fix that

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java (Easy)

    Ditto Kevin's comment...its nice to see someone making the initiative to write tutorials, but if you are going to do so:

    a) spend some time with it - make it legible, compilable, readable, use proper syntax, use proper grammar, use proper code conventions, use javadoc commenting, etc... and most importantly, make it so anyone can follow it. Make it look 'textbook' (and no offense, but the above is far from achieving any of these points) - if you want someone to take them with authority and follow them, they have to be made to look like they were written by a teacher, not a student.

    b) write something that has not been done ad nauseum - there are countless demonstrates of 'hello world', and there are the standard java tutorials that most people will navigate to which Kevin pointed out. Think a bit outside the box and write things unique to distinguish them away from the rest.
    Last edited by copeg; May 1st, 2012 at 05:19 PM.

Similar Threads

  1. this is easy for those who know java!!
    By speaker in forum What's Wrong With My Code?
    Replies: 10
    Last Post: March 28th, 2012, 10:04 AM
  2. Easy Java Problem
    By AATroop in forum What's Wrong With My Code?
    Replies: 9
    Last Post: October 12th, 2011, 02:05 PM
  3. Java Image Problem! Probably easy fix!
    By TrivialFate in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 14th, 2011, 07:12 AM
  4. Quick easy Java question.
    By DHG in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 25th, 2011, 03:59 PM
  5. Databases in Java made Easy with JPersist
    By Lord.Quackstar in forum JDBC and Database Tutorials
    Replies: 1
    Last Post: June 14th, 2010, 06:38 AM