Hi guys I have a bit of a problem here about the alignment
no what I try it always end up like that, the 2nd-3rd row course and sexcode column is what I want to fix >.<

package studlist;

here's my code:

public class StudList {

    public static void main(String[] args) {
        //Variable Declaration

        int totalRec = 0, totalF = 0, totalM = 0, ctr;

    String[] studNo = {"397-1010", "380-1120", "390-1350", "345-1235"};
    String[] studNa = {"R.Santos", "A.Cruz", "J.Lim", "S.Corona"};
    String[] course = {"BSIT", "BSCS", "BSIT", "ACT"};
    char[] sexCode = {'M', 'M', 'F', 'F'};

    //Print Titles & Subtitles

    System.out.println("           List of Students");
    System.out.print("Student No.\tName\t\tCourse\t\tSex \n");

    //Print Student Records

    for (ctr = 0; ctr < studNo.length; ctr++)
        System.out.print(studNo[ctr] + "\t");
        System.out.print(studNa[ctr] + "\t");
        System.out.print(course[ctr] + "\t\t");
        System.out.print(sexCode[ctr] + "\n");

Attachments align.JPG 14.43 KB

There's something to be said for...

System.out.println("Student No.  Name        Course  Sex");
   System.out.printf("%-11s  %-10s  %-6s  %1s\n", studNo[ctr], studNa[ctr], course[ctr], sexCode[ctr]);
This question has already been answered. Start a new discussion instead.