String word = "words";
System.out.println(word.length());
System.out.println(word.substring(1,3));
Math.abs(-1);
5
or





1
public class Parent {
    public void p1() {
        System.out.println("hi");
    }
}

public class Child extends Parent {
    public void p1() {
        System.out.println("hello");
    }
}

public class Test {
    public static void main(String[] args) {
        Parent pa1 = new Child();
        pa1.p1();
        Parent pa2 = new Parent();
        pa2.p1();
        Child c1 = new Child();
        c1.p1();
        //Child c2 = new Parent();
        // c2.p1();
    }
}

Test.main(null);
hello
hi
hello
int x = 5;
double y = 5.0;
System.out.println((int) y);
System.out.println((double) x);
double z = (Math.random()*2)+1;
System.out.println(z);
System.out.println((int) z);
System.out.println(x+y);
System.out.println((int) (Math.random()*(10-2)+2));
5


5.0
1.46224648455248
1
10.0
4
String name, lastName;
name = "";
lastName = "";
double num1;
num1 = 5;
System.out.println(num1);
5.0
public class SomeClass {
    private static int y = 0;
    public void increment() {
        y++;
    }
    public int getY() {
        return y;
    }
}

public class NewClass extends SomeClass {
    private static int y;
    public int getY() {
        return y;
    }
}

public class Test2 {
    public static void main(String[] args) {
        SomeClass some = new SomeClass();
        SomeClass some2 = new SomeClass();
        SomeClass some3 = new SomeClass();
        NewClass some4 = new NewClass();
        SomeClass some5 = new NewClass();
        some.increment();
        System.out.println(some.getY());
        System.out.println(some2.getY());
        System.out.println(some3.getY());
        System.out.println(some4.getY());
        System.out.println(some5.getY());
    }
}

Test2.main(null);
8
8
8
0
0
int m = 4;
int n = 3;
int a;
int b;
for (int i = 0; i < m * n; i++)
{
   a++;
}
System.out.println(a);
for (int j = 1; j <= m; j++)
{
   for (int k = 1; k < n; k++)
   {
      b++;
   }
}
System.out.println(b);
12
8
System.out.println(true||true);
true
public class Vehicle {
    public int y;
    public int getY() {
        return y;
    }
}

public class Car extends Vehicle {}

public class Test3 {
    public static void main(String[] args) {
        Car car1 = new Car();
        System.out.println(car1.y);
    }
}

Test3.main(null);

0
public class Vehicle {
    public void go() {
        System.out.println("hi");
    }
    public void yeah() {
        System.out.println("yep");
    }
    public String info() {
        return "eat";
    }
}

public class Truck extends Vehicle {
    public void test() {
        System.out.println("hello");
    }

    public void yeah() {
        System.out.println("yeah");
    }
    public String info() {
        super.info();
        return "sing";
    }
}

public class Yeah {
    public static void main(String[] args) {
        Vehicle v = new Truck();
        Vehicle v2 = new Vehicle();
        Truck t = new Truck();
        v.go();
        t.test();
        v.yeah();
        t.yeah();
        v2.yeah();
        System.out.println(v.info());
        System.out.println(v2.info());
        System.out.println(t.info());
    }
}

Yeah.main(null);
hi
hello
yeah
yeah
yep
sing
eat
sing
public class ReferText {
    public void testing(String s, int i) {
        s = "change";
        i = 6;
    }
}

public class UhHuh {
    public static void main(String[] args) {
        ReferText r = new ReferText();
        String s = "u";
        int j = 2;
        System.out.println(s);
        System.out.println(j);
        r.testing(s, j);
        System.out.println(s);
        System.out.println(j);
    }
}

UhHuh.main(null);
u
2
u
2
public class A {
    public void test(B x, C c) {
        System.out.println("hm");
    }
}
public class B extends A {}
public class C extends B {}
A a = new A();
B b = new B();
C c = new C();
c.test(c,c);
hm
System.out.println((double) (4)/5);
System.out.println(0%3);
0.8
0