input scanner format
Scanner sc = new Scanner(System.in)
String myString = sc.next();
int myInt = sc.nextInt();
scanner.close();
System.out.println("myString is: " + myString);
System.out.println("myInt is: " + myInt);
input buffer format
import java.io.*;
import java.util.*;
import java.io.IOException;
public class Solution {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int i =Integer.parseInt(br.readLine());
double d =Double.parseDouble(br.readLine());
String s = br.readLine();
Widening Casting
int myInt = 9;
double myDouble = myInt;
Narrowing Casting
double myDouble = 9.78d;
int myInt = (int) myDouble;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in)
int t;
t=input.nextInt();
while(t>0)
{
int ans;
ans=input.nextInt()-input.nextInt();
System.out.println(ans);
t--;
}
}
}
//creates an array in the memory of length 10
int[] array = new int[10];
System.out.println("Enter the elements of the array: ");
for(int i=0; i<n; i++)
{
//reading array elements from the user
array[i]=sc.nextInt();
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while( T!=0 ){
int n = sc.nextInt();
int a = 1;
for(int i = 1; i <= n; i++ ){
a = a*i;
}
System.out.println(a);
T--;
}
}
}
-------------------------
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
int N = sc.nextInt();
String S = sc.next();
int z = N/2;
int y = 0;
int n = 0;
while( y <= z){
for(int h = 0 ; h <= N ; y++){
char d = S.charAt(h);
S.charAt(h) = S.charAt(n+1);
S.charAt(n+1) = d;
System.out.print(S);
h = h+2;
}
}
/* for(int c = 0; c < N; c++){
int a = S.charAt(c);
int r = 122 -(a-97);
char s = (char)r;
System.out.print(s);
}*/
}
}