'How can i print my information in Java WITHOUT any type of array

I'm trying to figure out how to print out a table without the use of an Array or Array list, I've been googling for a while and I am not sure how to do it. Can someone please help? Below is the code I am using whilst trying this.

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class arrayExampleBMI {

  public static void main(final String[] args) {

    final Scanner scanner = new Scanner(System.in);

    final List<Person> persons = new ArrayList<Person>();

    for (int i = 0; i < 3; i++) {

      final Person person = new Person();
      System.out.print("name ");
      person.first_name = scanner.next();
      System.out.print("weight, kg");
      person.kg = scanner.nextInt();
      System.out.print("Height, m");
      person.height = scanner.nextDouble();
      person.bmi = person.kg / (person.height * person.height);

      persons.add(person);

    }

    System.out.printf("%s %20s %20s %20s", "NAME", "Weight", "Height", "BMI");
    System.out.println();

    for (int i = 0; i < 3; i++) {
      System.out.printf("%-10s %12d %21.2f %22.2f", persons.get(i).first_name, persons.get(i).kg, persons.get(i).height,
          persons.get(i).bmi);
      System.out.println();

    }

  }
}

class Person {

  double bmi = 0;

  String first_name = null;

  double height = 0;

  int kg = 0;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source