Jump to content


- - - - -

Basic JAVA Programming


  • Please log in to reply
1 reply to this topic

#1 _*cipcip_*

_*cipcip_*
  • Guests

Posted 07 October 2007 - 11:17 AM

This is for JAVA users ...

so ... i am going to teach you how to create a simple java program that will show us a sentence ...

First i`ll write the code and then explain what they do ...

//Example
public class Ex1 {
public static void main(String args[] )
{
System.out.println( "Welcome to Java Programming!" );
}
}

Explanation:

- //Example ---> Comments, just like in html, php ... etcetera

- public class Ex1 ---> Every Java code begins with defining a class. Every class has an unique name and the source code for a class must be saved in a source file wich has the same name as the class. ( i.e. Ex1 )

- public static void main( String args[] ) ---> Classes contains both data and methods. The data can be numbers, text or different objects. Ex1 class has a single method called main. The main method of an object is the point from where the Java Virtual Machine (JVM) begins the execution of a program. An object can have many methods, but the Java Virtual Machine (JVM) must know the starting point of the program. This is a basic signature wich the inventors of JAVA chose.

- System.out.println( "Welcome to Java Programming!" ); ---> The object Ex1 sends to the System.out object a message in wich it tells it to show us using the println method what we have putted in the round brackets in our case the Welcome to Java Programming sentence.

Java code screenshot:

Posted Image

Java result screenshot:

Posted Image

P.S. I started learning java at the university so you`ll here from me again :P ... hope you enjoy this tutorial .. i think i explained it well enough.

#2 Swerls

Swerls

    Young Padawan

  • Members
  • Pip
  • 9 posts

Posted 17 November 2008 - 08:57 AM

sweet, im planning on learning java real soon, thanks
  • Demaemiain likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users