Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples Java
 

Creating objects in java


Code ResourceAuthor: Raju  

Difficulty Level:

Published: 2nd Sep 2007   Read: 1516 times  

Filed in: Java
Add Comment


 


This program comprises of creating two objects for our own class shown below. Here A is the main class a1,a2 are the objects created for the class.

 


Sample Code
  1.  
  2. class A
  3. {      
  4.         int i=1;
  5.         void show()
  6.         {
  7.                 System.out.println("i="+i);
  8.         }
  9. }
  10. class Display
  11. {
  12.         public static void main(String args[])
  13.         {
  14.                 A a1=new A();
  15.                 a1.show();
  16.  
  17.                 A a2=new A();
  18.                 a2.show();
  19.         }
  20. }
  21.  
Copyright GeekInterview.com


Next Article: Create a New Class


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. iamdvr35750
2. venki_madesh30853
3. srinivasaraobora22477
4. bora_srinivasarao11728
5. Kiran.jakkaraju4609
6. parmod kumar duhan4502
7. chowsys3970
8. Venkateswara Rao3713
9. Raju3390
10. Vamshidhar Matam2290

Active Coders

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape