Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

W 3 Print

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Ramos Alexander Knives TVL-ICT 12-

GRACIOUS
Week 3 VARIABLES
ACTIVITY 1

1. Float is a Java data type that stores floating point numbers, with decimals, such as 19.99 or -19.99.

2. String is a Java data type that stores text, such as "Hello". String values are surrounded by double quotes.

3 Variable is a named storage location in the computer’s memory. It allows you to store and work with data in the computer's memory.

4 Int is a Java data type that stores whole numbers, without decimals, such as 123 or -123.

5. Boolean is a Java data type that stores values with two states: true or false.

6. + or Concat() means to append. To concatenate the contents of a variable to a string or appends one string to another string.

7. Char is a Java data type that stores single characters, such as 'b" or 'C'. Char values are surrounded by single quotes.

8. Operands is an operator that stores the value on its right into the variable named on its left.

9. Numbers and strings a kind of information a variable store.

10. Assignment statement a statement that gives the variable on the left of an assignment operator the value of the expression on the right side of the
assignment operator.
ACTIVITY 2
1. The number of basketballs in a department store. integer
2. The price of a basketball. float
3. The number of players on a basketball team. integer
4. The average age of the players in a basketball team. integer
5. Whether a basketball player received a uniform or not. boolean
6. The first initial of a basketball player’s first name. character
7. The price of a basketball ticket to watch a game. float
8. The number of male and female audience in a basketball game. integer
9. The name of sponsor attached in a basketball uniform. string
10. The average age of the audience watching a basketball game. float

ACTIVITY 3 .ACTIVITY 4

Direction: Give two variable declarations for each type of data; String, int, float, LOCAL VARIABLE avariable that is declared inside the body of a
method

boolean and char. Write your answers on the space provided. Ex. int n=90;

String myText = “BreakALeg”, mytext = “Goodluck”; INSTANCE VARIABLE java variable is defined without the
Static keyword

int myNumer = 24, mynumber = 8; Ex. int data=50;

float myFloat = 24.4f, myfloat = 8.08f; STATIC VARIABLE initialized only once, just when the program
execution

boolean myBool = false, mybool = true; starts.


char myLetter = ‘R’, myletter = ‘A’; Ex. static int m=100;

You might also like