taking string input in java
Scanner in = new Scanner(System.in);
String s = in.nextLine();
taking string input in java
Scanner in = new Scanner(System.in);
String s = in.nextLine();
bufferedreader java
import java.io.BufferedReader;
//
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println(reader.readLine());
how to input in java
import java.util.Scanner;
...
Scanner console = new Scanner(System.in);
int num = console.nextInt();
console.nextLine() // to take in the enter after the nextInt()
String str = console.nextLine();
bufferedreader in java
class Main {
public static void main (String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" "); // 6 2
String[] input = br.readLine().split(" "); // 1 2 3 4 5 6
int n = Integer.parseInt(str[0]); // 6
int k = Integer.parseInt(str[1]); // 2
int [] arr = new int [n];
for(int i=0; i<n; i++)
{
arr[i] = Integer.parseInt(input[i]); // 1 2 3 4 5 6
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us