int x = 21;
String y = "Sample text";
System.out.printf("%s | x = %d
", y, x);
You Can Use System.out.printf("%d",n) also for formatting in java
class println{
public static void main(String [] args){
System.out.println(" Hello beiginner");// This is the format of a println statement that prints out a string on a different line separate from the others//
System.out.print(" Nice to see you");// This is the format of a print statement that prints out a string on the same line//
System.out.print(" noob");
}
}