String oldStr = "ABCDEF";
String newStr = oldStr.substring(1, 3) + oldStr.substring(4);
System.out.println(newStr);
BCEF
String oldStr = "ABCDEF";
//String newStr = oldStr.substring(1, 3) + oldStr.substring(4);
System.out.println(oldStr.substring(0,1));
System.out.println(oldStr.substring(2,2));
A

String[][] letters = {{"A", "B", "C", "D"},
{"E", "F", "G", "H"},
{"I", "J", "K", "L"}};

System.out.println(letters[0][3]);
System.out.println(letters[0].length);
D
4
String[][] letters = {{"A", "B", "C", "D"},
{"E", "F", "G", "H"},
{"I", "J", "K", "L"}};
for (int col = 1; col < letters[0].length; col++)
System.out.println(letters[0].length);
{
for (int row = 1; row < letters.length; row++)
{
System.out.print(letters[row][col] + " ");
}
System.out.println();
}
4
4
4
|   System.out.print(letters[row][col] + " ");
cannot find symbol
  symbol:   variable col
public static String combine()
{
int one = 10110;
int two = 01100;
String res = "";
for (int k = 0; k < one.length(); k++)
{
if (one.substring(k, k + 1).equals(two.substring(k, k + 1)))
{
res += one.substring(k, k + 1);
}
else
{
res += "0";
}
}
return res;
}
|   for (int k = 0; k < one.length(); k++)
int cannot be dereferenced

|   if (one.substring(k, k + 1).equals(two.substring(k, k + 1)))
int cannot be dereferenced

|   if (one.substring(k, k + 1).equals(two.substring(k, k + 1)))
int cannot be dereferenced

|   res += one.substring(k, k + 1);
int cannot be dereferenced

|   public static String combine()
Modifier 'static' not permitted in top-level declarations, ignored
String str = "CompSci";
System.out.println(str.substring(0, 3));
int num = str.length();
System.out.println(num);
Com
7
String str = "0";
str += str + 0 + 8;
System.out.println(str);
0008
int one = 1;
int two = 2;
String zee = "Z";
System.out.println(one + two + zee);
3Z
List<String> students = new ArrayList<String> (); 
students.add("Alex"); 
students.add ("Bob");
students.add ("Carl");

for (int k = 0; k < students.size (); k++)
{
System.out.print (students.set (k, "Alex") + " ");
}
System.out.println ();
for (String str: students)
{
System.out.print(str + "   ");
}
Alex Bob Carl 
Alex   Alex   Alex   
public static int countA(String str)
{
int count = 0;
 
while (str.length() > 0)
{
int pos = str.indexOf("A");
if (pos >= 0)
{
count++;
/* missing code */
}
else
{
return count;
}
}
return count;
}
String str = "FSSACABAC";

int pos = str.indexOf("A");

System.out.println(pos);
3
ArrayList<wordlist> str = new ArrayList<wordlist>();

ArrayList wordlist = ["apple", "banana", "coconut", "lemon", "orange", "pear"]

int count = 0;
for (String word : wordList)
{
if (word.indexOf("a") >= 0)
{
count++;
}
}
System.out.println(count);
|   ArrayList wordlist = ["apple", "banana", "coconut", "lemon", "orange", "pear"]
illegal start of expression
int[][] arr = {{6, 2, 5, 7},
{7, 6, 1, 2}};
for (int j = 0; j < arr.length; j++)
{
for (int k = 0; k < arr[0].length; k++)
{
if (arr[j][k] > j + k)
{
System.out.println("!");
}
}
}
!
!
!
!
!
!
int[][] data = new int[5][10];


for (int j = 0; j < data.length; j++)
{
for (int k = 0; k < data[0].length; k++)
{
if (j == k)
{
System.out.println(data[j][k]);
}
}
}
0
0
0
0
0
int[][] array2D = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12},
{13, 14, 15, 16}};
for (int[] i : array2D)
{
for (int x : i)
{
System.out.print(x + "h ");
}
System.out.println(" ");
}
1h 2h 3h 4h  
5h 6h 7h 8h  
9h 10h 11h 12h  
13h 14h 15h 16h  
String str = "no";

public static boolean mystery(String str)
{
    String temp = " ";

    for (int k = str.length(); k > 0; k--)
    {
        temp = temp + str.substring(k-1,k);
    }

    return temp.equals(str);
    System.out.println(temp.equals(str));
}
|       System.out.println(temp.equals(str));
unreachable statement

|   {
|       String temp = " ";
|   
|       for (int k = str.length(); k > 0; k--)
|       {
|           temp = temp + str.substring(k-1,k);
|       }
|   
|       return temp.equals(str);
|       System.out.println(temp.equals(str));
|   }
missing return statement

|   public static boolean mystery(String str)
Modifier 'static' not permitted in top-level declarations, ignored
String list = "hello";

System.out.println(list.size());
|   System.out.println(list.size());
cannot find symbol
  symbol:   method size()
private List<String> listOfwords;
public String wordswithCommas ()
{
String result = " (" ;
int sizeOfList = listOfWords.size() - 1 ;
for (int k = 0; k < sizeOfList; k++)
{
result = result + listOfWords.get(k);
    if (k! = 0) {
     result = result + ", ";
    }
}
result = result + "} ";
return result;
}
|       if (k! = 0) {
')' expected

|       if (k! = 0) {
illegal start of expression

|       if (k! = 0) {
';' expected
int a = 1988;
int b = 1990;
   
String claim = " that the world’s athletes " +
"competed in Olympic Games in ";
   
String s = "It is " + true + claim + a +
" but " + false + claim + b + ".";
   
System.out.println(s);
It is true that the world’s athletes competed in Olympic Games in 1988 but false that the world’s athletes competed in Olympic Games in 1990.
String s = "this is " + true;

System.out.println(s);
this is true
int[][] points = {{11, 12, 13, 14, 15},
{21, 22, 23, 24, 25},
{31, 32, 33, 34, 35},
{41, 42, 43, 44, 45}};
for (int row = 0; row < points.length; row++)
{
for (int col = points[0].length - 1; col >= row; col--)
{
System.out.print(points[row][col] + " ");
}
System.out.println();
}
15 14 13 12 11 
25 24 23 22 
35 34 33 
45 44 
public static void rowMajor(int[][] arr)
{
int[][] theArray = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
rowMajor(theArray);

for (int[] j : arr)
{
   for (int k : j)
   {
      System.out.print(k + " ");
   }
}
}
|   System.out.print(k + " ");
cannot find symbol
  symbol:   variable k
int j = 0;
ArrayList<> data = new ArrayList<>();
    data.add(4);
    data.add(3);
    data.add(4);
    data.add(5);
    data.add(3);
    data.add(4);

while (j < data.size() - 1)
{
if (data.get(j) > data.get(j + 1))
{
System.out.print(data.get(j + 1) + " ");
}
j++;
}
|   ArrayList<> data = new ArrayList<>();
illegal start of type
int [][] numbers = {{7, 8, 9}, {4, 5, 6}};

for (int[] row : numbers)
{
    for (int n : row)
    {
        System.out.print(row[n]);
    }
}
---------------------------------------------------------------------------
java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 3
	at .(#181:1)
int [][] numbers = {{1, 2, 3}, {4, 5, 6}};

for (int r = 0; r < numbers.length; r++)
{
    for (int c = 0; c < numbers[0].length; c++)
    {
        System.out.print(numbers[r][c]);
    }
}
123456
String s = "hello";

System.out.println(s.substring(0, 1));
h
int[][] arr = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
{3, 2, 1}};
for (int j = 0; j < arr.length; j++)
{
for (int k = j; k < arr[0].length; k++)
{
System.out.print(arr[j][k] + " ");
}
System.out.println();
}
1 2 3 
5 6 
9 

int[][] arr = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}};
int sum = 0;
for (int[] x : arr)
{
for (int y = 0; y < x.length - 1; y++)
{
sum += x[y];
System.out.println(sum);
System.out.println("--");

}
System.out.println(sum);
System.out.println("??");


}
System.out.println(sum);
1
--
3
--
6
--
6
??
11
--
17
--
24
--
24
??
33
--
43
--
54
--
54
??
54