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 Main { | |
public static void main(String[] args) { | |
Person person = new Person(); // will get error as defautl empty constructor is not given | |
} | |
} | |
class Person { | |
String firstName; |
#Android & Java
#Git Tutorial
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 ReferencePreservation { | |
public static void main(String[] args) { | |
B b = new B(); | |
b.x = 10; | |
System.out.println("Before method call b.x " + b.x); | |
A a = new A(); | |
a.method(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
var inputObject = { 0: 'a', 1: 'b', 2: 'c' }; | |
var values = []; | |
Object.keys(inputObject).forEach(function(key) { | |
values.push(inputObject[key]); | |
return values; | |
}); | |
console.log(values); |
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
// Always ensure Java Class Name is same as File Name in JavaFX. Otherwise give error in running | |
import javafx.application.Application; | |
import javafx.event.ActionEvent; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.StackPane; | |
import javafx.stage.Stage; |
September 9, 2015
Editors:
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
ImageView iv; | |
iv = (ImageView) findViewById(R.id.icon); | |
iv.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
ConnectivityManager mConMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo mNetworkInfo = mConMgr.getActiveNetworkInfo(); | |
if (mNetworkInfo != null && mNetworkInfo.isConnected()) { | |
System.out.println("Yes Connected"); | |
} else { |
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 Main { | |
static int max(int x, double y) { | |
return (x > y) ? x : (int) y; | |
} | |
static int max(double x, int y) { | |
return (x > y) ? (int) x : y; | |
} |