View RSS Feed

penguinCoder

  1. Future Cheat Sheets

    by , 10-30-2012 at 09:38 PM
    Just trying to think of the topics that I want to create cheat sheets about. In the next few weeks I plan on making many more of these, here are a few topics that I think I will start with:
    • Linked Lists
    • Abstract Data Types
    • Abstract Algorithmic Analysis
    • AWT Event Handling
    • Swing Components
    • Swing Event Handling?
    • Inheritance
    • Polymorphism
    • Interfaces
    • Exception Handling



    This is in no particular order, and I will probably be hopping around this list ...
    Categories
    Uncategorized
  2. File Input Output Cheat Sheet

    by , 10-30-2012 at 05:18 AM
    File Input Output Cheat Sheet

    Importing Libraries
    The primary library that deals with files:
    Java Code:
    import java.io.File;
    The library that deals with writing to files:
    Java Code:
    import java.io.PrintWriter;

    FYI
    If there is more then one type of information that is being transferred to or from a file, it is usually best to use a record; IMO.


    Writing to a File

    Declare ...
  3. 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
  4. 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>();
    ...
  5. 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
  6. 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..
    }
    ...
  7. 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; ...
  8. 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
  9. 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
  10. 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
  11. 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
  12. Some Basic Technical Terminolgy Cheat Sheet

    by , 10-10-2012 at 05:08 AM
    Well I just got out of class, and I thought I would do a brain dump of some of the terminology that is utilized in Programming and Computer Science. This is going to be in more human readable format then most places I have found on the Internet.

    Abstract Algorithm Analysis
    What is O(N)?
    Big O of N, and it is commonly pronounced, is when the run-time of an algorithm is approximately proportional to the size of the data (N), when there are large amounts of data; in the ...

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

    Categories
    Cheat Sheet