You are on page 1of 2

1.

Provide your own concept of java class

A java class is a part of the program that is performed where objects are defined,
those objects to be used are put the attributes to be occupied and operations,
attributes can be declared for text as String, for integers as Int and integer numbers
with decimals, with float.

2. What is an object?

An object is an existing entity in the memory of the computer, has attributes that
are declared in the java class.

3. What we say that a java class is a objet producer?

The java class is an object producer since for each class you can create infinite
objects as far as the memory of the computer allows.

4. Consider that your computer has 2GB of programmer memory. An object
generated by a class consumes 2 Kbytes of memory. How many objects
can I declare it? Why?

1 000 000, because 1 GB = 1 000 000 Kbyte. And objects can be created as many
times as required until the memory limit is exceeded.

5. Predict the output of following java program.
class Test {
int i;
}
class Main {
public static void main(String args[]) {
Test t = new Test();
System.out.println(t.i);
}
}

The output of this program is: i

System.println ("a = " + a + " b = " + b + "\n").print(). obj1. 6. obj2. demo obj2 = obj1. demo() { a = 10.println ("values of obj2 : "). obj1. b = 20.out.print().b += 1.a += 1. } public void print() { System.println ("values of obj1 : ").out. } } class Test { public static void main(String[] args) { demo obj1 = new demo(). System. b. class demo { int a. } } The output of this program is: . obj1.out. Predict the output of following java program.