java online compuider code example

Example 1: compile java online

Compile on w3 schools: ttps://www.w3schools.com/java/java_compiler.asp

Example 2: java compiler

import java.util.Scanner;
public class exercise30 {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in); 
int total = 0;
boolean current;«
System.out.print("Type in a bunch of values and I'll add them up. ");
System.out.println("I'll stop when you type a zero.");
while (total += current){
System.out.print("Value: ");
current = keyboard.nextInt();

System.out.println("The total so far is: " + total);
} while ( current != 0 );
System.out.println("The final total is: " + total);
} }

Tags:

Java Example