For example if we wrote one program like
class sum{
public static void main(String []k){
int a=10,b=30,c; c=a+b;
System.out.println("op is"+c);
}
}
in this program where is object?
For example if we wrote one program like
class sum{
public static void main(String []k){
int a=10,b=30,c; c=a+b;
System.out.println("op is"+c);
}
}
in this program where is object?
also when we run any java program there is one object internally created. object of java.lang.Class.
Here you have multiple objects !
When you will run your program, sum
is the first one. You also have an array of strings String []k
System
is also an object with a field out
which is of type `PrintStream``
"op is"+c
is also an object of type String
PS : note that a, b and c are primitive types. More about data types in java : https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html