In B4Coder you build a program from flowchart blocks, run it step by step, then press View Code to see it as Java. Change the flowchart and the Java changes with it.
Java is taught in ICSE Computer Applications and in many college courses. Every value has a type (int, double, String), and B4Coder works the types out from your blocks, so the flowchart stays simple.
About the code B4Coder writes: Save as Main.java. Each value's type (int, double, String) is worked out from your blocks.
The most common blocks, and the Java they turn into. View Code uses your own names and values.
age = Integer.parseInt(scanner.nextLine());
System.out.println("Hello, " + name);int total = 0;
if (age >= 18) {
...
} else {
...
}for (int i = 0; i < 10; i++) {
...
}while (total < 100) {
...
}Each one is a flowchart in B4Coder. This is the Java it turns into, exactly as View Code writes it.
Ask for two numbers and show the sum.
import java.util.*;
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double a = 0; double b = 0; double sum = 0;
System.out.print("What is the first number? "); a = Double.parseDouble(scanner.nextLine()); System.out.print("What is the second number? "); b = Double.parseDouble(scanner.nextLine()); sum = a + b; System.out.println("The sum is " + sum); }}Check whether a number is even or odd.
import java.util.*;
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int number = 0;
System.out.print("Enter a number "); number = Integer.parseInt(scanner.nextLine()); if (number % 2 == 0) { System.out.println("It is an Even number"); } else { System.out.println("It is an Odd number"); } }}Use a repeat loop to count from 1 to 10.
public class Main { public static void main(String[] args) { int count = 0;
count = 1; for (int i0 = 0, n0 = 10; i0 < n0; i0++) { System.out.println("Count: " + count); count = count + 1; } }}Build a flowchart, press Run to watch it work, then open View Code and pick Java. It's free, with no install.
Open the editor