public class Arithmetic { public static void main (String [] args) {
}
private static int add (int a, int b) {
}
}
public class Arithmetic {
public static void main (String [] args) {
int sum = add(10, 15);
System.out.println(sum);
}
private static int add(int num1, int num2) {
return num1 + num2;
}
}
public class Arithmetic {
public static void main (String [] args) {
Arithmetic a = new Arithmetic();
int sum = a.add(10, 15);
System.out.println(sum);
}
private int add(int num1, int num2) {
return num1 + num2;
}
}
public class Arithmetic {
public static void main (String [] args) {
Arithmetic a = new Arithmetic();
System.out.println(a.add(10, 15));
}
private int add(int num1, int num2) {
return num1 + num2;
}
}
public class Arithmetic {
public static void main (String [] args) {
Arithmetic arithmetic = new Arithmetic();
int a = 10;
int b = 15;
arithmetic.add( a + a, b * 2 );
System.out.println(a);
}
public void add (int a, int b) {
a = a + b;
}
}
public class MyClass {
int number;
String myString;
public static void main (String [] args) {
number = 2;
myString = "A Sentence.";
String anotherString = myString;
{
int blockNum = 62;
number = blockNum;
}
}
}
StringBuilder sb = new StringBuilder();
System.out.println(sb.append("Test").append("a string").append("building").toString());
System.out.println(String.format("%s %s %s", "Test", "a string", "building"));
String a = new String("Test");
String b = new String("Test");
if(a == b)
System.out.println("equal");
else
System.out.println("not equal");
String a = new String("Test");
String b = new String("Test");
if(a.equals(b))
System.out.println("equal");
else
System.out.println("not equal");
String a = "Test"; String b = "Test"; if(a == b) System.out.println("equal"); else System.out.println("not equal");