ArrayList<String> list = new ArrayList<>();
list.add("Hello");
list.add("World");
list.add("World1");
System.out.print(list.size());
System.out.print(list.get(0));
System.out.print(list.remove(1));
System.out.print(list.size());
3HelloWorld2
String n = "Hello";
System.out.print(n.substring(2,4));
ll
int[][] n = new int[4][4];

int count = 0;
for (int i = 0; i < n.length; i++) {
    for (int j = 0; j < n[i].length; j++) {
        n[i][j] = 1;
        count++;
    }
}

for (int i = 0; i < n.length; i++) {
    System.out.print("\n");
    for (int j = 0; j < n[i].length; j++) {
        System.out.print(n[i][j] + " ");
    }
}

System.out.print("\n");
System.out.print(n[0][0]);

int m = n.length;
for (int j= 1; j < m; j++);
{
    for (int k= 1; k < m; k++)
    {
//        n[j][k] = n[j - 1][k] + n[j][k - 1];
    }
}
    

System.out.print(n[2][2]);

j = 2;
int k = 2;  
System.out.print("\n");
System.out.print(n[j - 1][k] + n[j][k - 1]);
1 1 1 1 
1 1 1 1 
1 1 1 1 
1 1 1 1 
11
2
int count1 = 0; 
for (int i = 0; i < 4*3; i++)
{
    System.out.print(count1);
    count1++; 
}

int count2 = 0; 
System.out.print("\n");
for (int i = 1; i <= 4; i++)
{
    for (int j = 1; j < 3; j++)
    {
        System.out.print(count2);
        count2++;
    }

}


01234567891011
01234567
String oldStr = "ABCDEF" ;
String newStr = oldStr. substring(1, 3) + oldStr. substring (4);
System. out .println(newStr);
BCEF
2, 3, 0, 2, 1 
ArrayList<Integer> numList = new ArrayList<Integer>() ;
numList.add (3);
numList.add (2);
numList.add (1);
numList.add (1, 0); 
numList.set(0, 2);
System. out. print (numList) ;
[2, 0, 2, 1]
ArrayList<String> animals = new ArrayList<>();
animals.add ( "fox");
animals.add(0, "squirrel");
animals.add ("deer");
animals.set(2, "groundhog" ) ; animals.add (1, "mouse");
System.out.println(animals.get (2) + " and " + animals.get (3)) ;
fox and groundhog
ArrayList<Double> conditionRating = new ArrayList<Double> () ;
conditionRating.add (9.84) ;

conditionRating. add (8.93) ;

conditionRating. add (7.65 );

conditionRating.add (6.24) ;

conditionRating. remove (2) ;

conditionRating.set (2, 7.63);


System.out.println (conditionRating);
[9.84, 8.93, 7.63]
ArrayList<String> colors = new ArrayList<String>();
colors. add ("Red" ) ; colors. add ( "Orange");
colors.set(1, "Yellow"); colors.add(1, "Green" );
colors. set(colors.size () - 1, "Blue");
colors. remove (0) ;
System. out. println (colors) ;
[Green, Blue]
ArrayList<String> numbers = new ArrayList<String>();
numbers. add ( "one");

numbers. add ("two" ) ;

numbers. add (0, "three");

numbers.set (2, "four");

numbers. add ( "five");

numbers.remove (1);

System. out. println (numbers) ;

[three, four, five]
System.out.println((double)(2/4));

double x = (double) 2/4+3;
System.out.println(x);

System.out.println("\n");

double x = (double) (2/3);
System.out.println(x);

0.0
3.5


0.0
double x = (int) (5.5 - 2.5) ;
double y = (int) 5.5 - 2.5;
System.out. println (x);
System.out. println (y);
System.out. println (x - y);
3.0
2.5
0.5
int x = (int)(Math.random()*10);
System.out.println(x);
8
double y = (int) 5.9;
System.out. println (y);
5.0
ArrayList<String> values = new ArrayList<String>();

values.add("apple");
values.add("banana");
values.add("coconut");
values.add("lemon");
values.add("orange");
values.add("pear");
int count = 0;
for (String word : values)
{
if (word.indexOf("a") >= 0)
{
count++;
}
}
System.out.println(count) ;
4
String alpha = new String ("APCS");
String beta = new String("APCS");
String delta = alpha;
System.out.println(alpha.equals(beta)) ;
System. out. println (alpha == beta) ;
System. out. println(alpha == delta) ;
true
false
true
String alpha = new String ("hello");
String beta = new String("hello");
System. out. println (alpha == beta) ;
false
int a = 5;
int b = 2;
double c = 3.0;
System.out. println(5 + a / b*c- 1);
System.out. println(a / b*c);
10.0
6.0
int[][] n = new int[4][5];

4
int[][] n = new int[4][4];

int count = 0;
for (int i = 0; i < n.length; i++) {
    for (int j = 0; j < n[i].length; j++) {
        n[i][j] = count;
        count++;
    }
}

for (int i = 0; i < n.length; i++) {
    System.out.print("\n");
    for (int j = 0; j < n[i].length; j++) {
        System.out.print(n[i][j] + " ");
    }
}

n[4][0]


0 1 2 3 
4 5 6 7 
8 9 10 11 
12 13 14 15 


---------------------------------------------------------------------------

java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4

	at .(#16:1)

int[] oldArray = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int[][] newArray = new int[3][3];
int row = 0; int col = 0;
for (int index = 0; index < oldArray.length; index++)
{
    newArray[row][col] = oldArray[index]; row++;
if ((row % 3) == 0)
{
col++;
row = 0;
}
}
System.out.println(newArray[0][2]);
7
int[][] mat = new int[4][4];

for (int i = 0; i < mat.length; i++) {
    for (int j = 0; j < mat[i].length; j++) {
        mat[i][j] = 1;
    }
}


int n = mat. length;

for (int j= 1;j<n; j++)
{
    for (int k = 1; k < n; k++)
    {
        mat[j][k] = mat[j - 1][k] + mat[j][k -1];
    }
}

mat[2][2];


for (int i = 0; i < mat.length; i++) {
    System.out.print("\n");
    for (int j = 0; j < mat[i].length; j++) {
        System.out.print(mat[i][j] + " ");
    }
}



1 1 1 1 
1 2 3 4 
1 3 6 10 
1 4 10 20 
int[] ray = new int[11];
int count = 0; 

for (int n : ray)
{
    System.out.println(count + ". " + n);
    System.out.print("\n");
    count++;
}
0. 0

1. 0

2. 0

3. 0

4. 0

5. 0

6. 0

7. 0

8. 0

9. 0

10. 0