Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: just need explaination

  1. #1
    Banned
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default just need explaination

     public class Cube1 {
     
    	int length;
    	int breadth;
    	int height;
    	public int getVolume() {
    		return (length * breadth * height);
    	}
    	Cube1() {
    		length = 10;
    		breadth = 10;
    		height = 10;
    	}
    	Cube1(int l, int b, int h) {
    		length = l;
    		breadth = b;
    		height = h;
    	}
    	public static void main(String[] args) {
    		Cube1 cubeObj1, cubeObj2;
    		cubeObj1 = new Cube1();
    		cubeObj2 = new Cube1(10, 20, 30);
    		System.out.println("Volume of Cube1 is : " + cubeObj1.getVolume());
    		System.out.println("Volume of Cube1 is : " + cubeObj2.getVolume());
    	}
    }


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    83
    My Mood
    Cynical
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: just need explaination

    Um, maybe it's me, but I don't see a question anywhere. What confuses you?

Similar Threads

  1. code explaination
    By deependeroracle in forum Java Theory & Questions
    Replies: 3
    Last Post: February 17th, 2012, 10:50 PM