java onlie code example
Example 1: online java compiler
SandBox: https://codesandbox.io/
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);
} }