+ 2

Whenever I try to take input a string using scanner class program is compiled but execution is not done why???

22nd Oct 2017, 7:37 AM
shivam srivastava
shivam srivastava - avatar
8 Respostas
+ 24
hey buddy , execution is done but u can't see it , //for seeing that its executed , u can print what u have taken as input String input = sc.nextLine (); System.out.print(input); //hope it helps ☺
22nd Oct 2017, 8:02 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 24
import java.util.*; class Inp { public static void main(String args[]) { Scanner sc=new Scanner(System.in); String s=sc.nextLine(); System.out.println(s); } } //sorry ,i noticed just now //hope it helps ☺
22nd Oct 2017, 9:09 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 23
can u show the code by making it public
22nd Oct 2017, 8:21 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
Is it ryt??
22nd Oct 2017, 8:38 AM
shivam srivastava
shivam srivastava - avatar
+ 2
I printed but it's execution is in process not printed
22nd Oct 2017, 8:15 AM
shivam srivastava
shivam srivastava - avatar
+ 2
import java.util.*; class Inp { public static void main() { Scanner sc=new Scanner(System.in); String s=sc.nextLine(); System.out.println(s); } }
22nd Oct 2017, 8:38 AM
shivam srivastava
shivam srivastava - avatar
+ 2
Thank you sir
22nd Oct 2017, 4:31 PM
shivam srivastava
shivam srivastava - avatar
+ 1
Sir I wanted to ask a program like I'm declaring one int type array say marks n one String type array say name I want to prepare a merit list in descending order of marks n print the marks along with the name. Sorting I know but don't know if it is possible then plz suggest me
22nd Oct 2017, 4:44 PM
shivam srivastava
shivam srivastava - avatar