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 String makinStrings() { | |
| String s = "Fred"; | |
| s = s + "47"; | |
| s = s.substring(2, 5); | |
| s = s.toUpperCase(); | |
| return s.toString(); | |
| } |
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 Person { | |
| private String name; | |
| public Person(String name) { | |
| this.name = name; | |
| } | |
| public boolean equals(Object o) { | |
| if (!(o instanceof Person)) | |
| return false; |
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 Test { | |
| public static void test(String str) { | |
| int check = 4; | |
| if (check == str.length()) { | |
| System.out.print(str.charAt(check -= 1) +", "); | |
| } else { | |
| System.out.print(str.charAt(0) + ", "); | |
| } | |
| } |
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 Test { | |
| public static void test(String str) { | |
| int check = 4; | |
| if (check = str.length()) { | |
| System.out.print(str.charAt(check -= 1) +", "); | |
| } else { | |
| System.out.print(str.charAt(0) + ", "); | |
| } | |
| } |
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 Test { | |
| public static void main(String[] args) { | |
| // insert code here | |
| System.out.println(s); | |
| } | |
| } |
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 Test { | |
| Integer i; | |
| int x; | |
| public Test(int y) { | |
| i = x + y; | |
| System.out.println(i); | |
| } | |
| public static void main(String[] args) { |
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 Test { | |
| Integer i; | |
| int x; | |
| public Test(int y) { | |
| x = i + y; | |
| System.out.println(x); | |
| } | |
| public static void main(String[] args) { |
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 void testIfA() { | |
| if (testIfB("True")) { | |
| System.out.println("True"); | |
| } else { | |
| System.out.println("Not true"); | |
| } | |
| } | |
| public Boolean testIfB(String str) { | |
| return Boolean.valueOf(str); |
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 String toString() { | |
| StringBuffer buffer = new StringBuffer(); | |
| buffer.append('<'); | |
| buffer.append(this.name); | |
| buffer.append('>'); | |
| return buffer.toString(); | |
| } |
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 Person { | |
| private String name, comment; | |
| private int age; | |
| public Person(String n, int a, String c) { | |
| name = n; | |
| age = a; | |
| comment = c; | |
| } |