Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Лаба1
- Задача1
- public class HelloWorld {
- public static void main(String[] args){
- System.out.println("Я думаю, быть программистом - это круто");
- }
- }
- Задача2.Раскомментить строки 5 и 9, 10
- public class HelloWorld {
- public static void main(String[] args){
- System.out.print("My second");
- System.out.print(" ");
- System.out.println("program");
- }
- }
- Задача3.
- public class HelloWorld {
- public static void main(String[] args){
- System.out.println("Будешь плохо кодить, придет Java и съест твою память».);
- }
- }
- Лаба2
- Задача1.Я хз, знаете ли вы циклы
- public class Lab2 {
- public static void main(String[] args){
- for(int i = 0; i < 5; i++){
- System.out.println("Мои первые шаги к познанию Java");
- }
- }
- }
- Задача2.
- public class Lab2 {
- public static void main(String[] args){
- int currentYear = 2017;
- int xYearsAgo = 22;
- System.out.println(currentYear-xYearsAgo);
- }
- }
- Задача3
- public class Lab2 {
- public static void main(String[] args){
- String name = "Владимир";
- int age = 15;
- String city = "Озерск";
- System.out.println(name);
- System.out.println(age + " лет");
- System.out.println(city);
- System.out.println("Мои первые шаги к познанию Java");
- System.out.println("Мои первые шаги к познанию Java");
- }
- }
- Задача 4.
- public class Lab2 {
- public static void main(String[] args){
- int x = 2;
- int x = 12;
- y = x + y;
- x = y - x;
- y = y - x;
- System.out.println(x);
- System.out.println(y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement