chore: remove unused repl-related configuration and placeholder files
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
int[] arr = new int[5];
|
||||
arr.length
|
||||
int[] nums = {1, 2, 3, 4, 5};
|
||||
nums.length
|
||||
nums[0]
|
||||
nums[4]
|
||||
String[] names = {"Alice", "Bob", "Charlie"};
|
||||
names.length
|
||||
names[0]
|
||||
names[1]
|
||||
double[] vals = {1.5, 2.5, 3.5};
|
||||
vals[0]
|
||||
vals[2]
|
||||
%whos
|
||||
%quit
|
||||
@@ -0,0 +1,16 @@
|
||||
class Point { public int x; public int y; public Point(int px, int py) { this.x = px; this.y = py; } }
|
||||
Point p = new Point(3, 4);
|
||||
p.x
|
||||
p.y
|
||||
class Rectangle { public int width; public int height; public Rectangle(int w, int h) { this.width = w; this.height = h; } public int area() { return this.width * this.height; } public int perimeter() { return 2 * (this.width + this.height); } }
|
||||
Rectangle r = new Rectangle(5, 10);
|
||||
r.width
|
||||
r.height
|
||||
r.area()
|
||||
r.perimeter()
|
||||
class Counter { public int count; public Counter() { this.count = 0; } public void inc() { this.count++; } public void dec() { this.count--; } public int get() { return this.count; } }
|
||||
Counter c = new Counter();
|
||||
c.get()
|
||||
%classes
|
||||
%whos
|
||||
%quit
|
||||
@@ -0,0 +1,16 @@
|
||||
%help
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
int c = 3;
|
||||
%whos
|
||||
%who
|
||||
int triple(int x) { return x * 3; }
|
||||
%methods
|
||||
class Foo { public int val; }
|
||||
%classes
|
||||
%reset
|
||||
%whos
|
||||
%who
|
||||
%methods
|
||||
%classes
|
||||
%quit
|
||||
@@ -0,0 +1,8 @@
|
||||
for (int i = 0; i < 5; i++) { System.out.println(i); }
|
||||
int sum = 0; for (int i = 1; i <= 10; i++) { sum = sum + i; } System.out.println(sum);
|
||||
int x = 10; while (x > 0) { System.out.println(x); x = x - 2; }
|
||||
int n = 1; do { System.out.println(n); n = n * 2; } while (n < 100);
|
||||
int val = 2; switch (val) { case 1: System.out.println("one"); break; case 2: System.out.println("two"); break; default: System.out.println("other"); }
|
||||
if (5 > 3) { System.out.println("yes"); } else { System.out.println("no"); }
|
||||
for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { System.out.println(i * 3 + j); } }
|
||||
%quit
|
||||
@@ -0,0 +1,8 @@
|
||||
undefined_variable
|
||||
1 + "string"
|
||||
int x = ;
|
||||
class { }
|
||||
1 / 0
|
||||
int y = 10;
|
||||
y
|
||||
%quit
|
||||
@@ -0,0 +1,24 @@
|
||||
1 + 2
|
||||
3 * 4
|
||||
10 - 5
|
||||
20 / 4
|
||||
17 % 5
|
||||
-42
|
||||
1 + 2 * 3
|
||||
(1 + 2) * 3
|
||||
10 > 5
|
||||
10 < 5
|
||||
10 == 10
|
||||
10 != 5
|
||||
true && false
|
||||
true || false
|
||||
!true
|
||||
1 < 2 && 3 < 4
|
||||
5 > 3 ? 100 : 200
|
||||
1 | 2
|
||||
3 & 2
|
||||
4 ^ 1
|
||||
~0
|
||||
8 >> 2
|
||||
1 << 3
|
||||
%quit
|
||||
@@ -0,0 +1,16 @@
|
||||
Math.abs(-42)
|
||||
Math.abs(42)
|
||||
Math.sqrt(16.0)
|
||||
Math.sqrt(2.0)
|
||||
Math.pow(2.0, 10.0)
|
||||
Math.min(5, 3)
|
||||
Math.max(5, 3)
|
||||
Math.floor(3.7)
|
||||
Math.ceil(3.2)
|
||||
Math.round(3.5)
|
||||
Math.sin(0.0)
|
||||
Math.cos(0.0)
|
||||
Math.tan(0.0)
|
||||
Math.log(2.718281828)
|
||||
Math.exp(1.0)
|
||||
%quit
|
||||
@@ -0,0 +1,21 @@
|
||||
int add(int a, int b) { return a + b; }
|
||||
add(3, 4)
|
||||
add(10, 20)
|
||||
int square(int x) { return x * x; }
|
||||
square(5)
|
||||
square(12)
|
||||
int factorial(int n) { if (n <= 1) return 1; return n * factorial(n - 1); }
|
||||
factorial(5)
|
||||
factorial(10)
|
||||
int fib(int n) { if (n <= 1) return n; return fib(n - 1) + fib(n - 2); }
|
||||
fib(10)
|
||||
fib(15)
|
||||
double avg(double a, double b) { return (a + b) / 2.0; }
|
||||
avg(10.0, 20.0)
|
||||
boolean isEven(int n) { return n % 2 == 0; }
|
||||
isEven(4)
|
||||
isEven(7)
|
||||
String greet(String name) { return "Hello, " + name + "!"; }
|
||||
greet("World")
|
||||
%methods
|
||||
%quit
|
||||
@@ -0,0 +1,22 @@
|
||||
class Person {
|
||||
public String name;
|
||||
public int age;
|
||||
public Person(String n, int a) {
|
||||
this.name = n;
|
||||
this.age = a;
|
||||
}
|
||||
public String describe() {
|
||||
return this.name + " is " + this.age + " years old";
|
||||
}
|
||||
}
|
||||
Person p = new Person("Alice", 30);
|
||||
p.name
|
||||
p.age
|
||||
p.describe()
|
||||
int compute(int x,
|
||||
int y,
|
||||
int z) {
|
||||
return x + y + z;
|
||||
}
|
||||
compute(1, 2, 3)
|
||||
%quit
|
||||
@@ -0,0 +1,19 @@
|
||||
String s = "hello world";
|
||||
s
|
||||
s.length()
|
||||
s.toUpperCase()
|
||||
s.toLowerCase()
|
||||
s.charAt(0)
|
||||
s.substring(0, 5)
|
||||
s.indexOf("world")
|
||||
s.contains("ell")
|
||||
s.startsWith("hello")
|
||||
s.endsWith("world")
|
||||
s.trim()
|
||||
String a = "foo";
|
||||
String b = "bar";
|
||||
a + b
|
||||
a.equals("foo")
|
||||
a.compareTo(b)
|
||||
%whos
|
||||
%quit
|
||||
@@ -0,0 +1,23 @@
|
||||
int x = 5;
|
||||
int y = 10;
|
||||
x
|
||||
y
|
||||
x + y
|
||||
x * y
|
||||
x - y
|
||||
x / y
|
||||
x % y
|
||||
long big = 1000000000;
|
||||
big
|
||||
double pi = 3.14159;
|
||||
pi
|
||||
float f = 2.5;
|
||||
f
|
||||
boolean flag = true;
|
||||
flag
|
||||
char c = 'A';
|
||||
c
|
||||
String name = "Rava";
|
||||
name
|
||||
%whos
|
||||
%quit
|
||||
Reference in New Issue
Block a user