Created
November 25, 2014 22:17
-
-
Save szymonzo/13c7a5ce8741624cd918 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////ZAD 5/////////////////////////////////////// | |
public class Zad5Zew { | |
private static int pole; | |
private void doSomething() { | |
System.out.println("robie cos"); | |
System.out.println("POLE " + getPole()); | |
} | |
public int getPole() { | |
return pole; | |
} | |
private void Wew() { | |
Zad5Wew x = new Zad5Wew(); | |
x.setPole(30); | |
} | |
public class Zad5Wew { | |
public void setPole(int pole) { | |
doSomething(); | |
Zad5Zew x = new Zad5Zew(); | |
x.pole = pole; | |
} | |
} | |
public static void main(String[] args) { | |
Zad5Zew x = new Zad5Zew(); | |
x.Wew(); | |
x.doSomething(); | |
} | |
} | |
///////////////////////////////ZAD 6 /////////////////////////////////////////////////////////////// | |
package com.softproideas.app.admin.uczelnia; | |
import com.softproideas.app.admin.uczelnia.Zad6Zew.Zad6Wew; | |
public class mdds { | |
Zad6Zew c = new Zad6Zew(); | |
Zad6Wew x = c.new Zad6Wew(); | |
} | |
package com.softproideas.app.admin.uczelnia; | |
public class Zad6Zew { | |
public class Zad6Wew{ | |
} | |
} | |
//////////////////////////////////////////////////////////////////// ZAD 7 /////////////////////////// | |
public class Zad6Zew { | |
private int a; | |
public int getA() { | |
return a; | |
} | |
public void setA(int a) { | |
this.a = a; | |
} | |
public class Zad6Wew { | |
private int c; | |
public void method() { | |
Zad6Zew.this.setA(3); | |
System.out.print(Zad6Zew.this.a);// dostep z wewnetrznej Klasy do pola zewnetrznej Klasy | |
} | |
public int getC() { | |
return c; | |
} | |
public void setC(int c) { | |
this.c = c; | |
} | |
} | |
public static void main(String[] args) { | |
Zad6Zew x = new Zad6Zew(); | |
Zad6Wew c = x.new Zad6Wew(); | |
// Zad6Zew.Zad6Wew = new Zad6Zew(); // SYTUACJA ODWROTNA JEST NIE MOZLIWA KLASA ZEW NIE MOZE MODYFIKOWAC POLA KLASY WEWNETRZNEJ | |
c.method(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment