Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zestaw3_1;
- public class Zestaw3_1 {
- int a;
- static int b; //pole statyczne
- void metodaA() {
- System.out.println("Metoda a");
- }
- static void metodaB() {
- System.out.println("Metoda b");
- }
- public static void main(String[] args) {
- Zestaw3_1 o = new Zestaw3_1();
- //ZLE // a=1
- b = 1; //odwolanie jest ok bo odnosi sie do bierzacej klasy (Zestaw3_1)
- Zestaw3_1.b = 2; //odwolanie przez podanie nazwy klasy
- o.b = 3; //odwoladnie przez referencje konkretnego obiektu
- metodaB();
- Zestaw3_1.metodaB();
- o.metodaB();
- o.metodaA();
- //ZLE // metodaA();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement