Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Memory-allocation/Java/memory-allocation-1.java
Normal file
5
Task/Memory-allocation/Java/memory-allocation-1.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
//All of these objects will be deallocated automatically once the program leaves
|
||||
//their scope and there are no more pointers to the objects
|
||||
Object foo = new Object(); //Allocate an Object and a reference to it
|
||||
int[] fooArray = new int[size]; //Allocate all spaces in an array and a reference to it
|
||||
int x = 0; //Allocate an integer and set its value to 0
|
||||
7
Task/Memory-allocation/Java/memory-allocation-2.java
Normal file
7
Task/Memory-allocation/Java/memory-allocation-2.java
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
public class Blah{
|
||||
//...other methods/data members...
|
||||
protected void finalize() throws Throwable{
|
||||
//Finalization code here
|
||||
}
|
||||
//...other methods/data members...
|
||||
}
|
||||
12
Task/Memory-allocation/Java/memory-allocation-3.java
Normal file
12
Task/Memory-allocation/Java/memory-allocation-3.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
public class NoFinalize {
|
||||
public static final void main(String[] params) {
|
||||
NoFinalize nf = new NoFinalize();
|
||||
}
|
||||
public NoFinalize() {
|
||||
System.out.println("created");
|
||||
}
|
||||
@Override
|
||||
protected void finalize() {
|
||||
System.out.println("finalized");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue