Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/practices/practice_3/task/task_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package practices.practice_3.task;

public class task_1 {

public static void main(String[] args) {

byte byteValue = 5;
byte byteZero = 0;

short shortValue = 100;
short shortZero = 0;

int intValue = 1000;
int intZero = 0;

long longValue = 100000L;
long longZero = 0L;

float floatValue = 1.5f;
float floatZero = 0.0f;

double doubleValue = 2.75;
double doubleZero = 0.0;

char charValue = 'A';
char charZero = '\u0000';

boolean booleanValue = true;
boolean booleanZero = false;

System.out.println("byte: " + byteValue + ", zero: " + byteZero);
System.out.println("short: " + shortValue + ", zero: " + shortZero);
System.out.println("int: " + intValue + ", zero: " + intZero);
System.out.println("long: " + longValue + ", zero: " + longZero);

System.out.println("float: " + floatValue + ", zero: " + floatZero);
System.out.println("double: " + doubleValue + ", zero: " + doubleZero);

System.out.println("char: " + charValue + ", zero: '" + charZero + "'");
System.out.println("boolean: " + booleanValue + ", zero: " + booleanZero);
}
}
20 changes: 20 additions & 0 deletions src/practices/practice_3/task/task_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package practices.practice_3.task;

public class task_2 {

public static void main(String[] args) {

String name =
"\u0410" +
"\u043B" +
"\u0435" +
"\u043A" +
"\u0441" +
"\u0430" +
"\u043D" +
"\u0434" +
"\u0440";

System.out.println(name);
}
}
17 changes: 17 additions & 0 deletions src/practices/practice_3/task/task_4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package practices.practice_3.task;

public class task_4 {
public static void main(String[] args) {

Integer year = 2025;
String result3 = "Год: " + year;
System.out.println(result3);

String text = "Возраст: ";
int age = 20;

String result1 = text + age;
System.out.println(result1);

}
}
28 changes: 28 additions & 0 deletions src/practices/practice_3/task/task_8.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package practices.practice_3.task;

interface Flyable {
void fly();
}

class Sparrow implements Flyable {
@Override
public void fly() {
System.out.println("Воробей летает");
}
}

class Penguin {
public void swim() {
System.out.println("Пингвин плавает");
}
}

public class task_8 {
public static void main(String[] args) {
Flyable sparrow = new Sparrow();
sparrow.fly();

var penguin = new Penguin();
penguin.swim();
}
}