I/O as well as File Handling inward Java.
 
There are 3 ways available for reading input:
i) Scanner
ii) DataInputStream
iii) BufferedReader
---------------
Using java.util.Scanner is the easier as well as includes many methods to banking enterprise agree input information is valid to read.
Example:---------------
package javaiooperations;
import java.util.Scanner;
public flat ReadInput {
public static void main(String [] args){
Scanner scan = novel Scanner(System.in);
    
System.out.println("Enter Your Name");
String s1 = scan.nextLine();
System.out.println("Your Name is: " + s1);
    
System.out.println("Enter Your City Name");
String s2 = scan.next();
System.out.println("Your City Name is: " + s2);
    
System.out.println("Enter Your Number");
int a = scan.nextInt();
System.out.println("Your Number is: " + a);
    
System.out.println("Enter Your City Name");
double b = scan.nextDouble();
System.out.println("Value is: " + b);
scan.close();
}
}
-------------------------------------------
File treatment inward Java----------------------
Two categories of File System Operations
i) High flat operations / External operations
Create a folder
delete a folder
create a text file
delete a text file etc...
ii) Low flat operations / Internal operations
Read data
Write information etc...
------------------------
Using File Class nosotros tin perform High flat operations
Examples:
1) Create a Folder
package javaiooperations;
import java.io.File;
public flat CreateFolder {
    
populace static void main(String [] args){
File fileObject = novel File("C:/Users/G C Reddy/Desktop/Selenium");
fileObject.mkdir();
}
}
---------------------------------
2) Check the beingness of Selenium Folderpublic static void main(String [] args){
File fileObject = novel File("C:/Users/G C Reddy/Desktop/UFT");
boolean a = fileObject.exists();
System.out.println(a);
}
-------------------------------------
3) Delete a Folder
public static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium");
abc.delete();
boolean a = abc.exists();
//System.out.println(a);
if (a == true) {
System.out.println("Folder exists");
}
else{
System.out.println("Folder doesn't exist");
}
}
-----------------------------------
4) Create a Text file
public flat CreateFolder {
    
populace static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
displace {
abc.createNewFile();
} select handgrip of (IOException e) {
// TODO Auto-generated select handgrip of block
e.printStackTrace();
}
-------------------------------------------
5) Delete a text file populace static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
abc.delete();
        
}
------------------------------------
  Sumber http://www.gcreddy.com/
There are 3 ways available for reading input:
i) Scanner
ii) DataInputStream
iii) BufferedReader
---------------
Using java.util.Scanner is the easier as well as includes many methods to banking enterprise agree input information is valid to read.
Example:---------------
package javaiooperations;
import java.util.Scanner;
public flat ReadInput {
public static void main(String [] args){
Scanner scan = novel Scanner(System.in);
System.out.println("Enter Your Name");
String s1 = scan.nextLine();
System.out.println("Your Name is: " + s1);
System.out.println("Enter Your City Name");
String s2 = scan.next();
System.out.println("Your City Name is: " + s2);
System.out.println("Enter Your Number");
int a = scan.nextInt();
System.out.println("Your Number is: " + a);
System.out.println("Enter Your City Name");
double b = scan.nextDouble();
System.out.println("Value is: " + b);
scan.close();
}
}
-------------------------------------------
File treatment inward Java----------------------
Two categories of File System Operations
i) High flat operations / External operations
Create a folder
delete a folder
create a text file
delete a text file etc...
ii) Low flat operations / Internal operations
Read data
Write information etc...
------------------------
Using File Class nosotros tin perform High flat operations
Examples:
1) Create a Folder
package javaiooperations;
import java.io.File;
public flat CreateFolder {
populace static void main(String [] args){
File fileObject = novel File("C:/Users/G C Reddy/Desktop/Selenium");
fileObject.mkdir();
}
}
---------------------------------
2) Check the beingness of Selenium Folderpublic static void main(String [] args){
File fileObject = novel File("C:/Users/G C Reddy/Desktop/UFT");
boolean a = fileObject.exists();
System.out.println(a);
}
-------------------------------------
3) Delete a Folder
public static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium");
abc.delete();
boolean a = abc.exists();
//System.out.println(a);
if (a == true) {
System.out.println("Folder exists");
}
else{
System.out.println("Folder doesn't exist");
}
}
-----------------------------------
4) Create a Text file
public flat CreateFolder {
populace static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
displace {
abc.createNewFile();
} select handgrip of (IOException e) {
// TODO Auto-generated select handgrip of block
e.printStackTrace();
}
-------------------------------------------
5) Delete a text file populace static void main(String [] args){
File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
abc.delete();
}
------------------------------------