java - writing a program to obtain various data values from user and displaying it in different formats. -
this question has answer here: scanner skipping nextline() after using next(), nextint() or other nextfoo()? 14 answers i newbie in java , have written program display flight details import java.io.*; import java.util.scanner; class main { public static void main(string args[]) { int ticket; string name,destination; float fare; char tclass; scanner in = new scanner(system.in); system.out.println("enter flight name : "); name=in.nextline(); system.out.println("enter ticket no : "); ticket=in.nextint(); system.out.println("enter flight fare : "); fare=in.nextfloat(); system.out.println("enter travelling class : "); tclass=in.next().charat(0); system.out.println("enter source : "); string source=in.nextline(); system.out.println("enter destination