This file contains hidden or 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
//--------- first example ------------------ | |
public class test { | |
public static void main(String[] args) { | |
// write your code here | |
test caller = new test(); | |
CallBack callBack = new CallBackImpl(); | |
caller.register(callBack); | |
callBack.methodToCallBack(); |
This file contains hidden or 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 MainActivity extends AppCompatActivity{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
RelativeLayout m_Layout = (RelativeLayout) findViewById(R.id.m_layout); | |
RelativeLayout f_Layout = (RelativeLayout) findViewById(R.id.f_layout); | |
m_Layout.setOnClickListener(m_LayoutListener); | |
f_Layout.setOnClickListener(f_LayoutListener); |
This file contains hidden or 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 Animal implements Comparable<Animal>{ | |
public String name; | |
public int year_discovered; | |
public String population; | |
public Animal(String name, int year_discovered, String population){ | |
this.name = name; | |
this.year_discovered = year_discovered; | |
this.population = population; | |
} |
This file contains hidden or 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 static void main(String[]args) throws Exception{ | |
String bip = "bip.mp3"; | |
Media hit = new Media(new File(bip).toURI().toString()); | |
MediaPlayer mediaPlayer = new MediaPlayer(hit); | |
mediaPlayer.play(); | |
Scanner scanner = new Scanner(System.in); | |
String fileName = scanner.nextLine(); |
This file contains hidden or 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 static void main(String[] args) throws Exception{ | |
BufferedReader reader = new BufferedReader(new FileReader("file.csv")); | |
String line; | |
int sum = 0; | |
while ((line = reader.readLine()) != null){ | |
for (String i : line.split(",")) { | |
System.out.print(i +','); | |
sum += Integer.parseInt(i); | |
} |
This file contains hidden or 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
package day5; | |
import java.io.*; | |
import java.util.Scanner; | |
/** | |
* Created by Hrant on 17.03.2017. | |
*/ | |
public class Day5Homework { |
This file contains hidden or 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
package day4; | |
import java.util.Arrays; | |
/** | |
* Created by Hrant on 15.03.2017. | |
*/ | |
public class Day4Homework { | |
public static void main(String[] args) { | |
System.out.println(firstLast6(new int[] {13, 6, 1, 2, 3})); |
This file contains hidden or 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
package Day3; | |
import java.util.ArrayList; | |
import java.util.Random; | |
import java.util.Scanner; | |
/** | |
* Created by Hrant on 3/11/2017. | |
*/ | |
public class Game { |
This file contains hidden or 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
package Day2; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
/** | |
* Created by Hrant on 10.03.2017. | |
*/ |
This file contains hidden or 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
package Day2; | |
import java.util.Scanner; | |
/** | |
* Created by Hrant on 10.03.2017. | |
*/ | |
public class TnayinDay2 { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); |
NewerOlder