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 Main | |
{ | |
public static void main(String[] args) { | |
int[] arr = {1,7,56,0,34,999}; | |
boolean swapped = true; | |
int i; | |
while (swapped) { | |
swapped = false; | |
for (i = 0; i < arr.length - 1; ++i) { |
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
// this is also useful for things like MyObj.contain(instance) | |
@Override | |
public boolean equals(Object compared) { | |
boolean flag = false; | |
if (this == compared) { | |
flag = true; | |
} else if (compared instanceof MyObj) { | |
Book comparedMyObj = (MyObj) compared; |
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
#include<iostream> | |
float division (float a, float b) { | |
return a / b; | |
} | |
template <class generic> | |
generic generic_division (generic a, generic b) { | |
return a / b; | |
} |
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
import java.nio.file.Paths; | |
import java.util.Scanner; | |
public class ReadFile { | |
public static void main(String[] args) { | |
try (Scanner fileData = new Scanner(Paths.get("file.ext"))) { | |
while (fileData.hasNextLine()) { | |
current = fileData.nextLine(); | |
if(!current.equals("")) { | |
// have fun |