View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Initializing an Object

    by , 04-26-2012 at 06:06 PM
    Point class code is as following:
    Java Code:
    public class Point {
        public int x = 0;
        public int y = 0;
        //constructor
        public Point(int a, int b) {
            x = a;
            y = b;
        }
    }
    Single constructor is present in this class. One may do the recognition of the constructor as same name is used by the declaration as the class does & no return type is there. Constructor present will be taking 2 integer ...
    Categories
    Tutorial