Page 1 of 1

Java [old]

PostPosted: December 20th, 2012, 10:20 pm
by Jessica
References:
Introduction to Java Programming


Object Oriented Programming

Since Java is an object oriented programming language it has following features:

  • Reusability of Code
  • Emphasis on data rather than procedure
  • Data is hidden and cannot be accessed by external functions
  • Objects can communicate with each other through functions
  • New data and functions can be easily added

Java has powerful features. The following are some of them:
    Simple
    Reusable
    Portable (Platform Independent)
    Distributed
    Robust
    Secure
    High Performance
    Dynamic
    Threaded
    Interpreted

Re: Java

PostPosted: December 21st, 2012, 10:37 pm
by tomtiger11
I like Java.

(Does this post count as my anniversary post?)

Re: Java

PostPosted: December 22nd, 2012, 12:16 am
by Jessica
tomtiger11 » Dec 21 2012, 8:37 pm wrote:
I like Java.

(Does this post count as my anniversary post?)


It's tomorrow :P

Re: Java

PostPosted: December 22nd, 2012, 8:49 am
by tomtiger11
Jessica » Dec 21 2012, 10:16 pm wrote:
tomtiger11 » Dec 21 2012, 8:37 pm wrote:
I like Java.

(Does this post count as my anniversary post?)


It's tomorrow :P

Well, since the forum official time is UTC, it was correct :P

Re: Java

PostPosted: January 15th, 2013, 1:09 am
by Jessica
HelloPrinter.java
Code: Select all
public class Hello Printer {
    public static 
void main(String[] args) {
       
System.out.println("Hello, World!"); } 


Program Run
Hello, World!



The line public class Hello Printer starts a new class.

The reserved word public denotes that the class is usable by the "public".

Re: Java

PostPosted: January 17th, 2013, 8:47 pm
by Jessica
Declaring Classes

Code: Select all
class MyClass {
    // field, constructor, and
    // method declarations
}


This is a class declaration. The class body (the area between the braces) contains all the code that provides for the life cycle of the objects created from the class: constructors for initializing new objects, declarations for the fields that provide the state of the class and its objects, and methods to implement the behavior of the class and its objects.

The preceding class declaration is a minimal one. It contains only those components of a class declaration that are required. You can provide more information about the class, such as the name of its superclass, whether it implements any interfaces, and so on, at the start of the class declaration. For example,
Code: Select all
class MyClass extends MySuperClass implements YourInterface {
    // field, constructor, and
    // method declarations
}

means that MyClass is a subclass of MySuperClass and that it implements the YourInterface interface.