Day 1
Today is the first day to study java. I started on the basic steps like know how to compile, where to get the compiler and how to run it via ms-dos prompt and via web.
So far i was able to get a compiler from java.sun.com website — j2sdk-1_4_2_18-windows-i586-p.exe. I was able to compile my basic java script using javac.
Before i was able to use the command javac, I went to the MS-DOS PROMPT and type PATH=c:\ j2sdk-1_4_2_18\bin.
Now I can use javac FILENAME.java to compile the file. Once the file is compiled, a new file will be created. FILENAME.class is the new file that was created.
To view the output of the file in MS DOS, use java FILENAME.
You must be logged in to post a comment.
08-15-2008 at 07:24
Day 2
1. Access Modifier - specifies the circumstances in which the class can be accessed. Example is public which indicates that this code can be accessed by all objects or can be extended, or used as a basis for another class. If public is omitted then you limit it only for this class. Access Modifier is followed by the word class.
2. Class Name - Example is public class XXX. The class name here is XXX which is a name assigned by you. It should be user-friendly word that is not on the list of reserved words, contain no spaces and must not begin with number.
Example:
Record123 (good) Record 123 (bad with space)
Employ 123data (bad begin with numbers)
3. public static void main ( String args[] ) - is a part of every Java application.
A. Paranthesis after main - indicate that main is a program building block called a method.
B. void - indicate that this method will perform a task but will not return any information when it completes its task.
08-15-2008 at 07:47
1. System.out - known as the standard output object. It allows java applications to display strings and other types of information in the command window from which the java application is executed.
2. println - of the System.out displays a line of information in the command window.
3. System.out.print - does not position to the beginning of the next line in the command window when it finishes displaying its argument. The next character that is displayed in the command window will appear immediately after the last character displayed with System.out.print.
08-15-2008 at 07:58
1. Class JOptionPane - defined in a package called javax.swing. It contains methods that display a dialog box containing information.
2. import - statement to locate classes required to compile a java program.
3. showMessageDialog - part of class JOptionPane. It shows the messages in a dialogue box with the result of an arguments.
4. Integer.parseInt - converts its String argument to an integer. Supposing you enter in a dialogue box a number then you can you this tag to convert it to integer.