You are on page 1of 2

[CPPROG2 [INTRODUCTION TO JAVA PROGRAMMING]] ACTIVITIY #2

NAME: DATE:
SECTION: CAMPUS:

INSTRUCTION/DIRECTION:

1. KINDLY DOWNLOAD THIS FILE PUT YOUR ANSWER UNDER THIS DOCUMENT.
2. FAILED TO FOLLOW INSTRUCTION WILL BE AUTOMATICALLY VOID/ZERO.
3. FILL UP ALL THE DETAILS ABOVE.

QUESTIONS:

1. Run the following code to see what is printed. Then, change the values and run it again.
Show your work by taking screenshot or print screen then paste it here. (50pts.)

public class VariableAssignment


{
public static void main(String[] args)
{
int score;
score = 4;
System.out.println(score);

double price = 23.25;


System.out.println(price);

boolean won = false;


System.out.println(won);
won = true;
System.out.println(won);

String name = "Jose";


System.out.println(name);
}
}

2. OPERATOR PRECEDENCE, TRY THIS OUT BY USING THE GIVEN VALUES, AND SHOW YOUR
ANSWER/WORK BY TAKING SCREENSHOT OT PRINT SCREEN. (50PTS.)
first_number = 80;
second_number = 105;
third_number = 25;
[CPPROG2 [INTRODUCTION TO JAVA PROGRAMMING]] ACTIVITIY #2

You might also like