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
class PassByReferenceTest { | |
public static void main(String args[]){ | |
PassByReference object = new PassByReference(); | |
System.out.println("In main method adress [1] --> " +object); | |
System.out.println("In main method value [1] --> " +object.getValue()); | |
change(object); | |
System.out.println("In main method adress [2] --> " +object); | |
System.out.println("In main method value [2] --> " +object.getValue()); |
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
class Node { | |
public int num1; // veriyi tutar. | |
public Node nextLink; // bir sonraki düğümü tutar. | |
//Node constructor | |
public Node(int d1) { | |
num1 = d1; | |
} | |
} |
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
class Node { | |
int data; | |
Node next; | |
Node previus; | |
public Node(int data){ | |
this.data = data; | |
this.next = null; | |
this.previus = null; |
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
public class StackWithArray { | |
private int size; | |
private int stackArray[]; | |
private int top; | |
public StackWithArray(){ //Constructor | |
this.size = 2; // Başlangıç için stack boyutu 2 olarak ayarlandı. | |
stackArray = new int[size]; | |
top = -1; | |
} |
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
// Base Class | |
class Ust | |
{ | |
void show() { System.out.println("Üst sınıfın metodu çağırıldı."); } | |
} | |
// Inherited class | |
class Alt extends Ust | |
{ | |
// Üst sınıfın metodu override edildi. |
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
class Base { | |
private void fun() { | |
System.out.println("Base fun"); | |
} | |
} | |
class Derived extends Base { | |
private void fun() { | |
//Mümkün değil. | |
System.out.println("Derived fun"); |
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
class Outer { | |
private String msg = "Outer private mesaj"; | |
private void fun() { | |
System.out.println("Outer fun() metodu çağırıldı."); | |
} | |
class Inner extends Outer { | |
private void fun() { | |
System.out.println("Outer'ın private üyesine erişim : " + msg); | |
} |
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
// Superclass | |
class Base { | |
// Subclassta gizli kalacak static metod. | |
public static void display() { | |
System.out.println("Base class icerisindeki static metod."); | |
} | |
// Subclassta override edilecek non-static metod. |
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
// Superclass | |
class Base { | |
// Subclassta saklanacak static metod. | |
public static void display() { | |
System.out.println("Static or class method from Base"); | |
} | |
// Subclassta override edilecek non-static metod. |
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
// Base Class | |
class Parent | |
{ | |
void show() | |
{ | |
System.out.println("Parent's show()"); | |
} | |
} | |
// Inherited class |