Advertisement
Guest User

Килькен Нубас

a guest
Feb 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. Лаба1
  2.  
  3. Задача1
  4. public class HelloWorld {
  5.     public static void main(String[] args){
  6.         System.out.println("Я думаю, быть программистом - это круто");      
  7.     }
  8. }
  9.  
  10. Задача2.Раскомментить строки 5 и 9, 10
  11. public class HelloWorld {
  12.     public static void main(String[] args){
  13.         System.out.print("My second");
  14.         System.out.print(" ");
  15.         System.out.println("program");
  16.     }
  17. }
  18.  
  19. Задача3.
  20. public class HelloWorld {
  21.     public static void main(String[] args){
  22.         System.out.println("Будешь плохо кодить, придет Java и съест твою память».);       
  23.     }
  24. }
  25.  
  26. Лаба2
  27. Задача1.Я хз, знаете ли вы циклы
  28. public class Lab2 {
  29.     public static void main(String[] args){
  30.         for(int i = 0; i < 5; i++){
  31.             System.out.println("Мои первые шаги к познанию Java");
  32.         }  
  33.     }
  34. }
  35.  
  36. Задача2.
  37. public class Lab2 {
  38.     public static void main(String[] args){
  39.         int currentYear = 2017;
  40.         int xYearsAgo = 22;
  41.         System.out.println(currentYear-xYearsAgo);     
  42.     }
  43. }
  44.  
  45. Задача3
  46. public class Lab2 {
  47.     public static void main(String[] args){
  48.         String name = "Владимир";
  49.         int age = 15;
  50.         String city = "Озерск";  
  51.         System.out.println(name);
  52.         System.out.println(age + " лет");
  53.         System.out.println(city);
  54.         System.out.println("Мои первые шаги к познанию Java");
  55.         System.out.println("Мои первые шаги к познанию Java");
  56.     }
  57. }
  58.  
  59. Задача 4.
  60. public class Lab2 {
  61.     public static void main(String[] args){
  62.         int x = 2;
  63.         int x = 12;
  64.         y = x + y;
  65.         x = y - x;
  66.         y = y - x;
  67.         System.out.println(x);
  68.         System.out.println(y);     
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement