View RSS Feed

penguinCoder

  1. AWT Component Cheat Sheet

    by , 10-30-2012 at 03:15 AM
    AWT Components Cheat Sheet

    Importing Libraries
    There are two main libraries that involve the AWT tools. This package contains the core AWT graphics classes. Contains component classes for buttons, text fields, labels, frames, panels, dialogs, and scroll panes. It also contains the layout managers such as flow layout, border layout, and grid layout. Also included are the cusrom graphics classes such as graphics, color and font.
    Java Code:
    import java.awt.*;
    ...

    Updated 10-30-2012 at 07:02 AM by penguinCoder

    Categories
    Cheat Sheet
  2. ArrayList Cheat Sheet

    by , 10-29-2012 at 12:17 PM
    Importing the Library
    Before you can use an ArrayList, you must first import the necessary library.
    Java Code:
    import java.util.ArrayList
    Creating a Generic ArrayList
    Generic ArrayList is an ArrayList with a type; no other type is allowed to be inserted into the ArrayList.
    Java Code:
    ArrayList<type> listName = new ArrayList<type>();
    Example of this would be:
    Java Code:
    ArrayList<String> myArrayList = new ArrayList<String>();
    ...
  3. Virtual Memory Cheat Sheet

    by , 10-27-2012 at 05:39 AM
    Brief Description:
    'Virtual' Memory is the mental model, or abstraction, that the programming language provides to the programmer to explain how computer memory is managed while you program is running. It is NOT the same as physical memory.

    Run Time:
    At run time, the operating system handles the translation from 'virtual' memory addresses to physical memory addresses, and the programmer does no need to be aware of this process.

    Static Region:
    This ...

    Updated 10-30-2012 at 05:19 AM by penguinCoder

    Categories
    Cheat Sheet
  4. Records Cheat Sheet

    by , 10-27-2012 at 05:25 AM
    Brief Description:
    A record is pretty much just a programmer defined data type. It combines one or more pieces of information, or potentially different data types, into one unit. Structure wise, it is just a template that defines how to interpret the contents of a sequence of memory locations.

    First outside of any class, define the new data type:
    Java Code:
    class recordName{
      public [dataType] fieldName;
      ..repeat for any number of types..
    }
    ...
  5. Random Number Cheat Sheet

    by , 10-27-2012 at 05:00 AM
    Just for FYI, computers cannot generate actual random numbers. They are machines, and they do what they are told; and therefore cannot just choose a number at random. Mathematicians would call the process this process 'psuedo-random' number generation, but I didn't feel that made a good title so, whatever.. Just covering all the bases.

    First you will have to import the library:
    Java Code:
    import java.util.Random;
    Next, you create a random number generator; ...
  6. Scanner Class Cheat Sheet

    by , 10-18-2012 at 01:26 AM
    The Scanner class can be used for many things other then just getting input from the user; however this cheat sheet/tutorial is just going to be about getting input from the user.

    Defining the Scanner Class
    Java Code:
    import java.util.Scanner;
    
    public class ClassName{
      ...code...
    }
    It will tell the translator to look in that directory for the code defining the Scanner class.


    Declaring the Scanner
    If you ...

    Updated 10-18-2012 at 01:29 AM by penguinCoder

    Categories
    Cheat Sheet
  7. String Cheat Sheet

    by , 10-18-2012 at 01:05 AM
    A string is a piece of text, that is zero or more characters in length. In Java, strings are considered to be pre-built objects. The variable for a string does not store the value of the string, rather it is a reference point, or pointer, to the storage location of where the string is kept.


    Declaring a String:
    Java Code:
    String s1;
    Assigning a Value On Declaration:
    Java Code:
    String s1 = "Hello World!";
    Assigning ...

    Updated 10-18-2012 at 01:29 AM by penguinCoder

    Categories
    Cheat Sheet
  8. Class and Method Terminology Cheat Sheet

    by , 10-17-2012 at 11:45 PM
    Class Body - the area between the braces, that contains all the code.

    Constructors - used for initializing new objects

    Declarations - fields that provide the state of the class and its objects

    Methods - implement the behaviour of the class and its objects

    Fields - member variables in a class

    Local Variables - variables in a method or a block of code

    Parameters - is the list of variables in a method declaration ...

    Updated 10-18-2012 at 01:30 AM by penguinCoder

    Categories
    Cheat Sheet
  9. Class and Method Cheat Sheet

    by , 10-17-2012 at 11:42 PM
    Declaring a Class
    Java Code:
    class ClassName{
      ...code...
    }

    Declaring a Class with Parent
    Java Code:
    class ClassName extends parentClassName{
      ...code...
    }

    Declaring a class with Interface
    Java Code:
    class ClassName implements interface1, interface2, interface3{
       ...code...
    }

    Declaring a Class with Fields
    Java Code:
    class ClassName{
      public
    ...

    Updated 10-18-2012 at 01:30 AM by penguinCoder

    Categories
    Cheat Sheet