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 sbt._ | |
import Keys._ | |
import sbtassembly.Plugin._ | |
import AssemblyKeys._ | |
import org.scalatra.sbt._ | |
import org.scalatra.sbt.PluginKeys._ | |
import com.mojolly.scalate.ScalatePlugin._ | |
import ScalateKeys._ | |
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 sbt._ | |
import Keys._ | |
import sbtassembly.Plugin._ | |
import AssemblyKeys._ | |
import org.scalatra.sbt._ | |
import org.scalatra.sbt.PluginKeys._ | |
import com.mojolly.scalate.ScalatePlugin._ | |
import ScalateKeys._ | |
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
package objectCreation; | |
public class TestObject implements Cloneable { | |
private String name = "DefaultTestName"; | |
public String getName() { | |
return name; | |
} | |
// By convention, classes that implement this interface should override |
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
package variableTypes; | |
public class InstanceVariables { | |
public int mCost;//manage outside class access using access modifiers. | |
//Default public constructor | |
public InstanceVariables(){} | |
public InstanceVariables(int profit){ |
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
package encapsulation; | |
public class EncapsulationExample { | |
public int left = 9; | |
public int right = 3; | |
// Now consider this question: Is the value of right always going to be one- | |
// third the value of left? It looks like it will, until you realize that | |
// users of the Foo class don’t need to use the setLeft() method! They can |
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
package inheritanceIsaAndHasA; | |
public class Car { | |
//color and maxSpeed are instance variables | |
private String color; | |
private int maxSpeed; | |
//Below are methods of Car class | |
public void carInfo() { | |
System.out.println("Car Color= " + color + " Max Speed= " + maxSpeed); |
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
package inheritanceIsaAndHasA; | |
//Refer : https://gist.github.com/rajeevprasanna/8499735 | |
public class InstanceOfExampleTest { | |
public static void main(String[] args) { | |
Test t1 = new Test(); | |
Test t2 = new Test(); | |
if (!t1.equals(t2)) {// equals compares references | |
System.out.println("they're not equal"); | |
} |
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
package inheritanceIsaAndHasA.codeReuseExample; | |
public class CodeReuseExampleTest { | |
public static void main(String[] args) { | |
PlayerPiece shape = new PlayerPiece(); | |
shape.displayShape(); | |
shape.movePiece(); | |
} | |
} |
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
package inheritanceIsaAndHasA.polymorphism; | |
public class GameShape { | |
public void displayShape() { | |
System.out.println("displaying shape"); | |
} | |
// more code | |
} |
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
package inheritanceIsaAndHasA.isa; | |
public class Car extends Vehicle { | |
// Cool Car code goes here | |
} |
OlderNewer