Game Development Reference
In-Depth Information
references to that object remain as the code is executed. This cannot entirely pre-
vent memory leaks, though. It is still possible that a reference to an object that is no
longer needed remains, as it is part of another structure, such as an array, which is
still active.
Nonetheless, the automatic garbage collector of Java spares a lot of effort to pro-
grammers, as they aren't forced to explicitly manage memory. Manual memory man-
agement in other languages can be a source for errors that can cause instability or
make a program crash, it is very hard to identify the causes unless complex method-
ologies are adopted.
Syntax
The Java syntax is basically derived from C++, and similar to C++, Java is an object-
oriented language. Java differs from C++ in the fact that it is less structured than
C++. In Java, every piece of code is written inside a class and everything, except the
usual language primitives (strings, integers, Boolean variables, and so on), is treated
as an object. Java also lacks some low-level features of C++ we discussed, such as
inheritance.
Java for mobile - Java ME
Java Micro Edition ( Java ME or J2ME ) is a subset of Java SE, designed for use on
mobile devices such as cell phones. Java ME is embedded in millions of dumb (non-
smart) devices around the world. For most smartphones, it is possible to download
and run Java-ME-based games that have been approved by their carrier.
As we already mentioned in Chapter 1 , Operating Systems - Mobile or Otherwise ,
Android-based smartphones run Java ME and the Android SDK, used to develop
mobile games for the Android platform, uses Java ME as well.
Gaikai is a very useful Java application for those of you that are interested in playing
video games demos. It is a cloud-based application, which allows playing PC and
console games on any computer or mobile device (provided it has access to an In-
ternet connection).
Search WWH ::




Custom Search