Tuesday, December 17, 2013

Tuesday, December 10, 2013

Constructor in JAVA : Day 5



 a) What happened when a constructor initialized in an Object?


b) Write a program to find the volume of a Box. Use Constructor to initialize the dimensions of a Box. Compute and Return the result using Method.

Method with return type in JAVA : Day 4



a) How Method return a value? Write necessary Syntax.

b) Write any JAVA program that takes parameters in a Method.

Method in JAVA : Day 3

a) How to access the instance variable using Method?


b) Write a program to calculate the Volume of a Box using Method.

Sunday, December 8, 2013

Object in JAVA : Day 2


a) What is Object? How to declare an Object in a JAVA program? Explain the Syntax of Object Declaration.

b) Write Syntax to assign an Object Reference Variable.

Friday, December 6, 2013

Class in JAVA : Day 1


  Explain the General Form of a Class.   --------------------------------------------------------------------------------------------------------------------------
Write a program to find the volume of a Box. Define only three instance variables: width, height and depth. Do not use Methods.
-----------------------------------------------------------------------------------------------------------------------------
package volbox;
class Bigbox
{
   double width;
   double depth;
   double height;
}
public class Volbox
{
  public static void main(String[] args)
  {
    Bigbox lbox=new Bigbox();
    lbox.width=15;
    lbox.depth=8;
    lbox.height=20;
    double vol=lbox.width * lbox.depth * lbox.height;
    System.out.println("Volume of box is:" +vol);
  }
}