0% found this document useful (0 votes)
60 views

Guiller Anthony C. Almonte CS 112L Tue 7 - 10 Am: Public Class

This document contains code examples and exercises from chapters 2, 3, and 4 of a Java programming textbook. It includes the main method of a sample Java class with print statements. It also lists true/false questions and code snippets to assign values to variables. The chapter 4 exercise asks to calculate an expression with given values for variables x and y.

Uploaded by

guianÜ
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Guiller Anthony C. Almonte CS 112L Tue 7 - 10 Am: Public Class

This document contains code examples and exercises from chapters 2, 3, and 4 of a Java programming textbook. It includes the main method of a sample Java class with print statements. It also lists true/false questions and code snippets to assign values to variables. The chapter 4 exercise asks to calculate an expression with given values for variables x and y.

Uploaded by

guianÜ
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Guiller Anthony C.

Almonte
CS 112L Tue 7 -10 am



Chapter 2 Exercise 2



public class ChapterExercise2 {

/**
* @param args
*/
public static void main(String[] args)
{
System.out.println("Its not about the money, money, money\n" +
"We don't need your money, money,money\n" +
"We just wanna make the world dance\n" +
"Forget\t\tabout\t\tthe\n" +
"\t \tPrice tag");


}

}

Chapter 3 Exercise
I.
2. TRUE
4. TRUE
6. FALSE
8. FALSE
II.
2. int tray =10;
4. String titleOfTheBook =7 Habits of Highly Effective People.;






Chapter 4 Exercise
I.
2. Assume a = 2 and b = 1
C=


C=


C=


C=


C = -2
4. Assume x = 1 and y = -2

( )




II.
2. unitPrice *= 0.5;
4. fee -= discount;

You might also like