Sunday 24 January 2016

Java Quick Reference - Tyro

This post will briefly gives you an idea about important Java syntax on one page to get you up to speed quickly, including:

Class Implementation:

public class MyClass {                                              
public String mString; 
private int mInt; 
// More member variables 
// Constructor for Class 
public MyClass() {
 mString = Foo; mInt = 10; }
 // More meth
 }                                                               
}

Declaring Variables:
double doubleVar = 1.0 
doubleVar = 2.0f
int intVar = 1; 
String stringVar = “Hey”; 
Boolean truth = true;

Sample Values:
int: 1, 2, 500, 10000 
double: 1.5, 3.14, 578.234 
boolean: true, false 
String: “Kermit”, “Gonzo”, “Ms. Piggy”                              
ClassName: Activity, TextView, etc

No comments: