Variables and if(s)
Task 0
Declare variable and assign a value. Display the variable in the next line.
Swap the lines. Try to compile and describe compiler behavior.
Task 1
Define three numerical variables: a, b, c.
Write a program that sorts it and display result i.e. "cab".
Task 2
Declare integer. Try to assign value 10.0.
Repair the code.
Task 3
We want to display "0.5", so we have written:
public class A {
public static void main(String[] args) {
System.out.println(1/2);
}
}
Task 4
Use "? :" operator. Show "even" or "odd" depending of user's input.
Task 5
Create an if-statement with "&&" in a condition. Then achieve the same results without ampersands.
Task 6
Unix-like operating systems use a number to tell about permissions for file or directory.
Example: 762 means "User can everything, group can write and read, anyone can write"
Number meaning:
Every digit meaning:
Write a program, that explains what a permission number means in human readable text.