Trikoti Mohan
Is it modify Object data? Generally Object data can't modify............but in this program it modifies.......... Why?
0 Answer(s)      5 years and 5 months ago
Posted in : Java Beginners

import java.io.*; public class Conversions { public static void main(String args[]) throws Exception { int a,b; DataInputStream dis=new DataInputStream(System.in);

            //String to Fundamental conversion
    System.out.print("Enter any integer value: ");
    a=Integer.parseInt(dis.readLine());


    //Fundamental to Object conversion
    System.out.println("Before fundamental to object conversion");
    System.out.println("a+10 value: "+(a+10)+"\t\t\ta+20 value: "+(a+20));
    System.out.println("After fundamental to object conversion");
    Integer io=new Integer(a);
    io++;
    io=io+2;
    System.out.println(io);
            System.out.println("Object data is modified");


}

}

Ads

View Answers









Ads

Advertisement