Hi Bryan,
Yes, I think Java is pretty easy to learn. It looks like C++, but is
much much easier than C++ to program games with. One of Java's huge
features is the Java runtime, JRE, has allot of classes which allows for
rapid development and design of programs. For example In only 10 lines
of code or
so I can slap together a Window that displays Hello World on the
screen. Not allot of other languages can clame that degree of symplisity
and still offer the same degree of power.
As far as formatting goes Java doesn't care if the code is formatted or
not. Weather you have everything formatted correctly or not formatted at
all javac will still compile your code, because all javac looks for is
if the seperators like braces, brackets, etc are in the correct places.
As a general rule of thumb if you want your code to be seen by anyone
else it is a good idea to use proper formatting for sighted programmers.
If you really don't know how to format a Java program there are format
tools like indent which will go through and correct your formatting for
you.
Below is a simple hello world program which creates a window using swing
and then creates a graphic with Hello World in it.
import java.awt.*;
import javax.swing.*;
public class Hello extends JComponent {
// Function: Main().
// Description: creates a simple Java window
// displaying "Hello World."
public static void main(String[] args) {
// Create Window frame.
JFrame window = new JFrame("Hello World");
// Set window size.
window.setSize(300, 300);
// Get window pane.
window.getContentPane().add(new Hello());
// Display window.
window.setVisible(true);
}
// Function: paintComponent(Graphics).
// Description: paints the words Hello World
// to the screen.
public void paintComponent(Graphics graphic)
{
// Paint text to the sscreen.
graphic.drawString("Hello, world!", 125, 95);
}
}
If you examine the code above you should be able to quickly see that
this simple program creates a simple Window and then paints the words
Hello World to the center of the window. What makes Java especially nice
is this program will compile and run on Mac, Linux, or Windows without
having to change one line of code. That is the power of Java that most
languages can't compare with.
Another reason why Java is good for games is it's class structure is
such you can include entire programs into your project. Java supports
what Java programmers call beans. A Java bean can be a collection of
components or it can be an entire program or programs that can be linked
together by a developer. An example of this is a casino game.
You could write several games like a black jack table, slot machine,
poker game, etc and then declare them as Java beans. You could then
create a separate program called Bryan's Casino that imports all the
casino games with a nice launcher program to select the game to play.
Pretty cool, eh?
Bryan Mckinnish wrote:
> Hi everyone.
> Remember when I told you I chose python? That's still an option, but I also
> wonder about java. That's a new option I thought of. Is java easy to learn
> as well?
> Does java have the formatting specification stuff?
> That's the only thing that's keeping me from exploring python more. I'm not
> used to formatting code.
> Thanks.
> Bryan Mckinnish
>
---
Gamers mailing list __ [email protected]
If you want to leave the list, send E-mail to [EMAIL PROTECTED]
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/[EMAIL PROTECTED]
If you have any questions or concerns regarding the management of the list,
please send E-mail to [EMAIL PROTECTED]