Java : Web Savy, Cross Platform

Introduction

From Wikipedia:
Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun's Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode which can run on any Java virtual machine (JVM) regardless of computer architecture.

Java is nearly ubiquitous with the World Wide Web. Because of the write once, run anywhere philosophy Sun has maintained since the beginning, Java is easily ported from one operating system to another with a minimum of fuss, making it an ideal development platform for ensuring maximum capatiblity. While there has been a shift of some developers moving towards newer web-centric languages, such as Ruby on Rails (or RoR), Java remains the go-to language for a majority of businesses.

As far as the examples I can show you right now, Java varies very little from C and C++. Java's class syntax is quite a bit different, as well as the code used in its GUI (graphical user interface) implementation.

Programmer's Notes

I have put together a short list of notes about the Java language, with an emphasis on the various types available in the core language:

Java Types

Primitive
  1. Integer
  2. Floating point
  3. Character - char
  4. Boolean - bool
Arrays
  1. Must be initialized to be used.
  2. Can be created in two ways:
  3. Multi-dimensional array
  4. String
  5. StringBuffer - similar to StringBuilder in C# - allows strings to be modified
Logical operators
  1. Equal to ==
  2. Not equal to !=
  3. Greater than >
  4. Less than <
  5. Greater than or equal to >=
  6. Less than or equal to <=
Boolean logical operators
  1. AND &
  2. OR |
  3. XOR ^
  4. OrElse ||
  5. AndAlso &&
  6. NOT !
  7. AND assignment &=
  8. OR assignment |=
  9. XOR assignment ^=
  10. Equal to ==
  11. Not equal to !=
  12. Ternary if-then-else ?:
Constant variables
  1. Use keyword final.
  2. Must be initialized when declared.
  3. Convention dictates that constants be identified by using UPPERCASE notation:
    final type VARIABLE-NAME = value;
Inheritance
  1. Use keyword extends to derive from a parent (base) class.
  2. Use keyword super to access the parent (base) class from a derived (child) class.
  3. Abstract defines a class or method that cannot be instantiated.
  4. Final defines a class that cannot be derived (inherited) from.
  5. Use the keyword package to define a namespace.
  6. Use the keyword import to include an external package (project) into the current project.
Standard Library
  1. Contained within the java package.
Interfaces
  1. Can be thought of as an action plan for your classes; that is, it defines WHAT your class must do, but not HOW it does it.
  2. Any class that uses the interface must implement all aspects of the interface.
  3. Interface methods/functions must be public.
  4. Interfaces cannot have instance variables. Interfaces can have variables, but they are implicitly static and final.
  5. Interfaces can derive from other interfaces, using the extends keyword.
  6. Use keyword implements to add an interface to a class object.

Want a copy of my notes?

If for some odd reason you find this useful, you can download a .doc version here.

Back to top Comments ( 0 ) • Login to comment.

Sorry. There are currently no comments for this article.