TsetsoP

Rabota v klas / tema_10

Nov 23rd, 2021 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. package 1
  2. -------------
  3. package package1;
  4.  
  5. public class A {
  6.     int R;//поле
  7.     float Area;//поле
  8.  
  9.     public static void main(String[] args) {
  10.         int R;//промелнлива от тип-целочислена
  11.  
  12.     }
  13.  
  14.     public void PrintR() {
  15.         System.out.println(R);
  16.  
  17.     }
  18.  
  19.     public float CalcArea(int R) {//R - параметър, който подаваме на метода
  20.         System.out.println(R);
  21.         return R;
  22.     }
  23. }
  24.  
  25. class c {
  26.  
  27. }
  28. ===================
  29. package 2
  30. ------------
  31. package package2;
  32. import package1.A;
  33.  
  34. public class B {
  35.     public static void main(String[] args) {
  36.         A aInstance;//= new A();
  37.         System.out.println("An instance of A was created.");
  38.     }
  39. }
  40. ===================
  41. Dog
  42. --------
  43. package Dog;
  44.  
  45. public class Dog {
  46.  
  47.     String name;
  48.     int age;
  49.     int length;
  50.     boolean isMale;
  51.  
  52.     public static void main(String[] args) {
  53.         Dog dog; // null
  54.         dog = new Dog();
  55.  
  56.         System.out.println("Dog's name is: " + dog.name);
  57.         System.out.println("Dog's age is: " + dog.age);
  58.         System.out.println("Dog's length is: " + dog.length);
  59.         System.out.println("Dog's is male: " + dog.isMale);
  60.     }
  61. }
  62.  
  63.  
  64.  
Add Comment
Please, Sign In to add comment