Intro to Java menu

User Tag List

Results 1 to 2 of 2
  1. #1
    Tristan's Avatar Banned
    Reputation
    203
    Join Date
    Jun 2007
    Posts
    698
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Intro to Java

    INTRODUCTION TO JAVA

    Hey, today I am going to school you all on the basics of Java.

    Reserved for setting up the JDK.

    Intro to Java
  2. #2
    Tristan's Avatar Banned
    Reputation
    203
    Join Date
    Jun 2007
    Posts
    698
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Class - A class in Java is much like one in C++. It consists of a group of related methods and variables lumped together under one name. The static class variables are for class-as-a-whole data. They are allocated only once at load time and are shared by all instances of objects of that class. The instance variables, are allocated inside each object of that class. Static class methods work when there is no current object. They can only reference static class variables and static methods, unless of course they allocate an object and then use explicit references to the instance variables. Instance methods work by default on the fields of the current this object.

    Public - Classes, methods, variables and constants that any user of the class is permitted to see and use, whether they belong to the same package or not, whether or not they are subclasses of this class. All interfaces are implicitly public.

    Static - refers to a method or variable that is not attached to a particular object, but rather to the class as a whole.

    Void - A keyword used in Java to indicate a method does not return a value. It is not used to indicate a method requires no parameters. Constructors don’t use the void keyword even though they don’t return an object.

    Main - Standalone applications don’t necessarily have init and start methods. They must have a public static void main routine to start things off. The main routine typically creates some object of the master class. It can’t use any non-static variables or methods in the class with the implied this, since there is no this object. It typically quickly returns. Then the event loop processing starts. Even the static main method must live inside some public class, or at least in the top class, the first class and the class for whom the source file is named. There are no such thing as standalone static methods in Java.

    Now that you have all of that skimmed over ( God knows you didn't read it ) we will be dealing with four main types of variables for simplicity's sake.

    int (lowercase) - int is used for any real number without a decimal from -2 billion to +2 billion

    double - double is used for any decimal number -1.7 x 10 ^308 to 1.7 x 10 ^308

    string - string is used for any sentence or group of characters.

    char - char is used for any single letter.

    _________________________________________________________
    The Basic Setup

    Code:
    class Test
    {
          public static void main ( String[] args )
          {
                System.out.println("Hello World!");
          }
    }
    class Test - You must name the set of code.

    public static void main ( String[] args ) - This line of code defines the classification of the code inside its brackets.

    System.out.println - Tells the program to print out the given text on a new ling (System.out.print can be used to print out code on consecutive lines.

    ("Hello World!"); - Hello World is a standard starting phrase to print out for beginning users. Any text within the (" ") is considered to be text, not code.

    ______________________________________________________________
    Declaring a variable and doing math with it

    Code:
    class Variables
    {
           public static void main ( String[] args)
           {
                  int variable1;
                  int total;
    
                  variable1 = 15;
                  total = variable1 + 2;
    
                  System.out.println("The total is " + total);
            }
    }
    int variable1; - This statement declares variable1 as an integer.
    int total; - This statement declares total as an integer.

    variable1 = 15; - This statement declares the integer variable1 as the real number 15.

    total = variable1 + 2; - This statement declares total as the sum of variable1 and 2.

    + total); - + total tells the program that you are no longer printing out an item in parenthesis.
    ___________________________________________________________

    last edited 3/10/08 17:40 CST

    Thanks to MindProd.com for their definitions.
    Last edited by Tristan; 03-10-2008 at 06:24 PM.

Similar Threads

  1. Intro page :)
    By T3LB01 in forum Suggestions
    Replies: 1
    Last Post: 09-06-2007, 05:17 PM
  2. intro
    By arby in forum Community Chat
    Replies: 6
    Last Post: 07-03-2007, 06:20 PM
  3. intro: Sandorffian
    By Sasukedk in forum World of Warcraft Exploration
    Replies: 6
    Last Post: 04-03-2007, 12:28 PM
  4. How to make a PVP intro like Fony
    By Valmilu in forum World of Warcraft Guides
    Replies: 4
    Last Post: 03-28-2007, 11:18 AM
  5. World of Warcraft: The Burning Crusade Cinematic Intro
    By johnson in forum World of Warcraft General
    Replies: 1
    Last Post: 12-14-2006, 04:21 PM
All times are GMT -5. The time now is 02:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search