Posts

Showing posts with the label class & object

java class and objects program

 program:-1 Syntex of class public class class_name {     //field;     //method;     }      2.java program to how to define a class and fields. class Demo {         int id ;         String name ;                 public static void main ( String args []){             Demo s1 = new Demo ();                         System . out . println ( s1 . id );             System . out . println ( s1 . name );             } } //output                     //0 //null                                    3.java program to demonstrat...