Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sample ArrayList
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { System.out.println("Hello, World!"); new Rextester().hello(); new Rextester().addNumberstoArrayList(); } private ArrayList <Integer> numbers; public Rextester() { numbers = new ArrayList<Integer>(); } public void addNumberstoArrayList() { int numberToAdd = 0; while(numberToAdd <= 40) { numbers.add(numberToAdd); numberToAdd += 2; } for(int number: numbers) { System.out.println(number); } } public String hello() { String hi = "Hello"; System.out.println("hi"); return hi; } }
run
|
edit
|
history
|
help
0
Ifelsenested
extendd11
Binary Tree Max path Sum
laba3
Pattern1
Random number
Array 11 grade (1-99)
Remove punctuation except numbers, commas and spaces
calc exp nha
Scope