[Solved] How to add a line with this sign “|” in between every column in java program ? What is the logic for loop? [closed]

Its simple: Let’s assume your each column is 15 characters wide, if it’s less or more change accordingly: // Format header System.out.println(String.format(“%1$-15s”, “EMPO” )+ “|”+”\t”+String.format(“%1$-15s”, “ENAME” )+ “|”+”\t”+String.format(“%1$15s”, “SAL” )+ “|”+”\t”+String.format(“%1$15s”, “AVERAGE” )+ “|”); Similarly format your row: I leave this one for you to practice. System.out.println(eno+”\t”+ename+”\t”+sal+”\t”+avg); If you are not able to figure out, … Read more