Java examples for Object Oriented Design:Class
Create a class with instance variables for height, weight, and depth.
Make each field an integer type.
Create a Java application that uses your new class.
Set each of these values in an object, and displays the values.
class Sample {/*from w w w .j a va 2s . c o m*/ int height; int weight; int depth; } public class Main { public static void main(String[] arguments) { Sample thing = new Sample(); thing.height = 72; thing.weight = 1; thing.depth = 42; System.out.println("Height: " + thing.height); System.out.println("Weight: " + thing.weight); System.out.println("Depth: " + thing.depth); } }