Advertisement
Paszta

Java - wprowadzenie

Mar 6th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.59 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package lab2;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author student
  13.  */
  14. public class Lab2 {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         Scanner scanner = new Scanner(System.in); //nowy obiekt przez new
  21.         int j = scanner.nextInt();
  22.         System.out.println("Liczba to: " +j);
  23.         int[]tab={1,2,3,4,5};
  24.         int tab2[]= new int[5];
  25.        
  26.         for(int i=0; i<5; i++){
  27.             tab2[i]=scanner.nextInt();
  28.         }
  29.        
  30.           for(int i=0; i<5; i++){
  31.             System.out.println("Liczba to: " +tab2[i]);
  32.         }
  33.     }
  34.    
  35. }
  36.  
  37.  
  38.  
  39.  
  40. ale chyba nie dziala
  41.  
  42. /*
  43.  * To change this license header, choose License Headers in Project Properties.
  44.  * To change this template file, choose Tools | Templates
  45.  * and open the template in the editor.
  46.  */
  47. package lab2;
  48.  
  49. import java.util.Scanner;
  50.  
  51. /**
  52.  *
  53.  * @author student
  54.  */
  55. public class Lab2 {
  56.  
  57.     /**
  58.      * @param args the command line arguments
  59.      */
  60.     public static void main(String[] args) {
  61.         Scanner scanner = new Scanner(System.in); //nowy obiekt przez new
  62.            
  63.             punkt p = new punkt(2,7);
  64.             int x= p.getX();
  65.               System.out.println("x= " +x);
  66.              
  67.               p.show();
  68.               boolean b= p.check();
  69.               System.out.println(b);
  70.         }
  71.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement