Posts

Showing posts with the label Java

Java Lesson -2

First Java Program: Let us look at a simple code that would print the words   Hello World . public class MyFirstJavaProgram {    /* This is my first java program.      * This will print 'Hello World' as the output     */     public static void main ( String [] args ){        System . out . println ( "Hello World" ); // prints Hello World     } } About Java programs, it is very important to keep in mind the following points. Case Sensitivity -   Java is case sensitive which means identifier   Hello   and   hello   would have different meaning in Java. Class Names -   For all class names the first letter should be in Upper Case.   If several words are used to form a name of the class each inner words first letter should be in Upper Case. Example   class ...

Java Lesson -1

What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral Portable Robust Multi-threaded Interpreted High Performance Distributed Dynamic Java Environment Setup: Java SE is freely available from the link   Download Java . So you download a version based on your operating system. You can refer to installation guide for a complete detail. Java Basic Syntax: Object -   Objects have states and behaviors. Example: A dog has states-color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class. Class -   A class can be defined as a template/ blue print that describe the behaviors/states that object of its type support. Methods -   A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed. Instant Vari...