Input space separated word and number

How to input space separated word and integer and store them in string and int variables
?
eg- naman 67
then
string s=‘naman’
int n=67

Scanner s=new Scanner(System.in);
String str=s.next();

	int n=s.nextInt();
	System.out.println(str);
	System.out.println(n);

Hi Ayush

As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.