The document provides examples of Java code using try, catch, throw, and exceptions to handle errors and exceptions. Program 36 introduces a try-catch block to handle potential InputMismatchExceptions from user input. Program 37 uses try-catch-finally to handle an ArithmeticException from division by zero and ensure the finally block always executes. Program 38 demonstrates multiple catch blocks to handle different exception types.
While software engineers can disagree on almost any concept of programming best-practice, the necessity of writing unit tests remains undisputed. With the advent of concurrent applications and the ongoing deprecation of the one-thread-per-request model, unit tests do however miss an increasing fraction of programming errors such as race conditions or dead-locking code. But is it even possible to write tests that revise such errors? In the end, a good unit test is characterized by a determined execution path what effectively prevents the use of concurrency within a single test. However, there are tools and programming principles that allow for unit tests of concurrent code. This talk reviews typical mistakes made when concurrent code is tested and introduces Thread Weaver, a test suite for writing valid unit tests that uncover concurrency-related programming errors.
While software engineers can disagree on almost any concept of programming best-practice, the necessity of writing unit tests remains undisputed. With the advent of concurrent applications and the ongoing deprecation of the one-thread-per-request model, unit tests do however miss an increasing fraction of programming errors such as race conditions or dead-locking code. But is it even possible to write tests that revise such errors? In the end, a good unit test is characterized by a determined execution path what effectively prevents the use of concurrency within a single test. However, there are tools and programming principles that allow for unit tests of concurrent code. This talk reviews typical mistakes made when concurrent code is tested and introduces Thread Weaver, a test suite for writing valid unit tests that uncover concurrency-related programming errors.
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch
Julien Ponge
This talk introduces part of the Java SE 7 novelties. The fork/join framework aims at making parallel programming simpler, while Project Coin brings a set of subtle yet useful changes to the Java programming language.
http://soft-shake.ch/2011/conference/sessions/java/2011/09/06/java7.html
An overview how to realize code generation of languages on the JVM that implement other class layouts than the Java programming languages. As an example, the inline-mock-maker for Mockito is discussed which supports languages like Kotlin that make any property final by default.
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch
Julien Ponge
This talk introduces part of the Java SE 7 novelties. The fork/join framework aims at making parallel programming simpler, while Project Coin brings a set of subtle yet useful changes to the Java programming language.
http://soft-shake.ch/2011/conference/sessions/java/2011/09/06/java7.html
An overview how to realize code generation of languages on the JVM that implement other class layouts than the Java programming languages. As an example, the inline-mock-maker for Mockito is discussed which supports languages like Kotlin that make any property final by default.
Write a java program that allows the user to input the name of a file.docxnoreendchesterton753
Write a java program that allows the user to input the name of a file that contains positive integers (one integer per line) The number of integers in the file The program should find all odd and even numbers and write the odd numbers to a file \"odd.txt\" and write the even numbers to another file \"even.txt\"
Solution
package expertques;
import java.io.File;
import java.io.PrintWriter;
import java.util.Scanner;
public class evenoddwithfile {
public static void main(String[] args) throws Exception {
File in;//file input
File even = new File(\"f://even.txt\");//creates file even
File odd = new File(\"f://odd.txt\");//creates file odd
Scanner s = new Scanner(System.in);//reads input from console or user
System.out.println(\"Enter the file name with path: \");
in = new File(s.nextLine());
System.out.println(\"Enter the number of integers n the file: \");
int n = s.nextInt();
if (in.exists()) {//checks if input file exist or not
Scanner ins = new Scanner(in);//reads input file
PrintWriter pe = new PrintWriter(even);//write to even file
PrintWriter po = new PrintWriter(odd);//writes to odd file
for (int i = 0; i < n; i++) {//loop till the numbers exists
int x = ins.nextInt();//reads from input file
if (x % 2 == 0) {//checks for even or odd
pe.println(x);//if even writes in even file
} else {
po.println(x);//if odd writes in odd file
}
}
pe.close();//closes even file very important else nothing will be written in the file
po.close();//closes odd file very important else nothing will be written in the file
System.out.println(\"File successfully written with odds and evens\");
} else {
System.out.println(\"Error file not found at specified path\");//if file not exist
}
}
}
output
run:
Enter the file name with path:
f://integers.txt
Enter the number of integers n the file:
8
File successfully written with odds and evens
BUILD SUCCESSFUL (total time: 6 seconds)
.
2. Write a program which will open an input file and write to an out.pdfrbjain2007
2. Write a program which will open an input file and write to an output file. Use exception
handling (try & Catch to display appropriate error handling).
Solution
herer is code:
import java.io.*;
public class Copytxt{
public static void main (String[] args)throws IOException {
int i;
FileInputStream fin;
FileOutputStream fout;
try {
// open input file
try {
fin = new FileInputStream(\"input.txt\"); // pass the input location file here
}
catch (FileNotFoundException e) { // if file not found
System.out.println(\"Input File Not Found\");
return;
}
// open output file
try {
fout = new FileOutputStream(\"output.txt\"); // pass the output location file here
}
catch (FileNotFoundException e) { // if file not found
System.out.println(\"Error Opening Output File\");
return;
}
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println(\"Usage: CopyFile From To\");
return;
}
// Copy File
try {
byte[] buffer = new byte[1024];
int length;
/*copying the contents from input stream to
* output stream using read and write methods
*/
while ((length = fin.read(buffer)) > 0){
fout.write(buffer, 0, length);
}
}
catch (IOException e) {
System.out.println(\"File Error\");
}
fin.close();
fout.close();
}
}.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class FileEdit {
public static List lines = new ArrayList();
public static void main(String[] args) throws IOException
{
Scanner s = new Scanner(System.in);
System.out.print("EDIT: ");
String fileName = s.nextLine();
BufferedReader br = new BufferedReader(new FileReader(new File(fileName)));
String str="";
int count=0;
while((str=br.readLine())!=null)
{
lines.add(count, str);
System.out.println((++count) + "> "+ str);
}
String text="";
String command = "";
System.out.print((++count)+"> ");
command=s.nextLine();
String commandArr[];
int flag;
while(!command.equals("E"))
{
flag=0;
commandArr = command.split("\\s");
if(commandArr[0].equals("I")) //Insertion
{
while(true)
{
if(commandArr.length==1&&flag!=2)
{
System.out.print((count)+"> ");
text = s.nextLine();
insertLine(text,count-1);
}
else if(commandArr.length==2&&flag!=2)
{
System.out.print((commandArr[1])+"> ");
count=Integer.parseInt(commandArr[1]);
text = s.nextLine();
insertLine(text,Integer.parseInt(commandArr[1])-1);
}
else
insertLine(text,count-1);
System.out.print((++count)+"> ");
command=s.nextLine();
commandArr = command.split("\\s");
if(commandArr[0].equals("I")||commandArr[0].equals("L")||commandArr[0].equals("D")||comm
andArr[0].equals("E"))
{
flag=1;
break;
}
else
{
flag=2;
text=command;
}
}
}
else if(commandArr[0].equals("L")) //Listing
{
printList();
}
else if(commandArr[0].equals("D")) //Deletion
{
if(commandArr.length==1)
{
deleteLine(count-1,count-1);
}
else if(commandArr.length==2)
{
deleteLine(Integer.parseInt(commandArr[1])-1,Integer.parseInt(commandArr[1])-1);
}
else if(commandArr.length==3)
{
deleteLine(Integer.parseInt(commandArr[1])-1,Integer.parseInt(commandArr[2])-1);
}
count=lines.size();
}
if(flag!=1)
{
System.out.print((count++)+"> ");
command = s.nextLine();
}
}
}
public static void insertLine(String text,int count)
{
if (count >= lines.size()) {
for(int i = lines.size(); i <= count; i++) {
lines.add(null);
}
}
lines.set(count,text);
}
public static void deleteLine(int start,int end)
{
for(int i=start;i<=end;i++)
lines.remove(i);
}
public static void printList()
{
for(int i=0;i "+lines.get(i));
}
}
Here is my output:
EDIT: textin.txt
1> The First Line
1>
2> And another line
3> I 3
3> The second line
4> One more line
5> L
1> null
2> null
3> The second line
4> One more line
5> D 2
3> L
1> null
2> The second line
3> One more line
4> E
How can I keep it from printing "null" after ">" and it just be blank. I need the output to look like
this:
1> The first line
2>
3> And another line
4> I 3
3> The second line
4> One more line
5> L
1> The first line
2>
3> The second line
4> One more line
5> And another line
5> D 2
4> L
1> The first line
2> The second line
3> One more line
4> And another line
5> E.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
1. 1
Chapter 5 Lab Manual
Program 35
//The program shown below terminates abnormally
if you enter a floating-point value instead of an
integer.
package ch5;
import java.util.Scanner;
public class ExceptionDemo {
public static void main(String args[]){
Scanner reader=new Scanner(System.in);
System.out.println("Enter a number :");
int num= reader.nextInt();
System.out.println("The number is :" +
num);
} }
Program 36
package ch4;
import java.util.Scanner;
import java.util.*;
public class ExceptionDemo {
public static void main(String args[]){
Scanner reader=new Scanner(System.in);
System.out.println("Enter a number :");
try {
int num= reader.nextInt();
System.out.println("The number is :" +
num);
}
catch (InputMismatchException e){
System.out.println("There is type mis
match :");
}
finally{
System.out.println("This part is always
done");
}} }
Program 37
package ch5;
class Example{
public static void main(String args[]) {
try{
int num=121/0;
System.out.println(num);
}
catch(ArithmeticException e){
System.out.println("Number should not be
divided by zero");
}
/* Finally block will always execute even if there
is no exception in try block*/
finally{
System.out.println("This is finally
block");
}
System.out.println("Out of try-catch-finally");
}
}
Program 38
//multiple catch blocks
package ch5;
public class Example1 {
public static void main(String args[]) {
int num1, num2;
try {
/* We suspect that this block of statement can
throw exception so we handled it by placing these
statements inside try and handled the exception in
catch block */
num1 = 0;
num2 = 62 / num1;
System.out.println(num2);
System.out.println("Hey I'm at the end of try
block");
}
catch (ArithmeticException e) {
/* This block will only execute if any
Arithmetic exception occurs in try block */
System.out.println("You should not divide a
number by zero");
}
catch (Exception e) {
/* This is a generic Exception handler which
means it can handle all the exceptions. This will
execute if the exception is not handled by previous
catch blocks.*/
System.out.println("Exception occurred");
}
System.out.println("I'm out of try-catch block in
Java.");
}}
Program 39
// Multiple catch blocks that select the exact
exception
package ch5;
class Example2{
public static void main(String args[]){
try{
int a[]=new int[7];
a[4]=30/0;
System.out.println("First print statement in try
block");
}
catch(ArithmeticException e){
System.out.println("Warning:
ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Warning:
ArrayIndexOutOfBoundsException");
}
catch(Exception e){
System.out.println("Warning: Some Other
exception");
}
System.out.println("Out of try-catch block...");
}}
2. 2
Program 40
// The use of throw
package ch5;
public class Examplezero{
void checkAge(int age){
if(age<18)
throw new ArithmeticException("Not
Eligible for voting");
else
System.out.println("Eligible for voting");
}
public static void main(String args[]){
Examplezero obj = new Examplezero();
obj.checkAge(15);
System.out.println("End Of Program");
}
}
Program 41
// The use of throws for multiple exception selection
package ch5;
import java.io.*;
class ThrowExample {
void myMethod(int num)throws IOException,
ClassNotFoundException{
if(num==1)
thrownew IOException("IOException
Occurred");
else
thrownew
ClassNotFoundException("ClassNotFoundExcepti
on");
} }
class Examples{
public static void main(String args[]){
try{
ThrowExample obj=newThrowExample();
obj.myMethod(1);
}catch(Exception ex){
System.out.println(ex);
} }}
Program 42
package ch5;
public class throwsdividedbyzero{
int division(int a, int b) throws
ArithmeticException{
int t = a/b;
return t;}
public static void main(String args[]){
throwsdividedbyzero obj = new
throwsdividedbyzero();
try{
System.out.println(obj.division(15,0));
}
catch(ArithmeticException e){
System.out.println("You shouldn't divide
number by zero");
} } }
3. 3
Chapter 6 Lab Manual
Program 43
package ch6;
// Use a BufferedReader to read characters from the
console.
import java.io.*;
class BRRead {
public static void main(String args[])
throws IOException{
char c;
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter characters, 'q' to quit.");
// read characters
do {
c = (char)br.read();
System.out.println(c);
} while(c != 'q');
}}
Program 44
package ch6;
// Read a string from console using a
BufferedReader.
import java.io.*;
class BRReadLines {
public static void main(String args[])
throws IOException
{
// create a BufferedReader using System.in
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
String str;
System.out.println("Enter lines of text.");
System.out.println("Enter 'stop' to quit.");
do {
str = br.readLine();
System.out.println(str);
}
while(!str.equals("stop"));
} }
Program 45
package ch6;
//copy byte
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes {
public static void main(String[] args) throws
IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("xanadu.txt");
out = new FileOutputStream("outagain.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}} }}
Program 46
package ch6;
// Creating a text File using FileWriter
import java.io.FileWriter;
import java.io.IOException;
class CreateFile {
public static void main(String[] args) throws
IOException {
// Accept a string
String str = "File Handling in Java using "+
" FileWriter and FileReader";
// attach a file to FileWriter
FileWriter fw=new FileWriter("output.txt");
// read character wise from string and write
// into FileWriter
for (int i = 0; i < str.length(); i++)
fw.write(str.charAt(i));
System.out.println("Writing successful");
//close the file
fw.close();
} }
Program 47
package ch6;
// copy characters
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class CopyCharacters {
public static void main(String[] args) throws
IOException {
FileReader inputStream = null;
FileWriter outputStream = null;
try {
inputStream = new
FileReader("xanadu.txt");
outputStream = new
FileWriter("characteroutput.txt");
int c;
while ((c = inputStream.read()) != -1) {
outputStream.write(c);
}
} finally {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}}}}
Program 48
package ch6;
// read file from the disk
4. 4
import java.io.*;
public class FileStats{
public static void main(String[] args) throws
IOException {
// the file must be called 'temp.txt'
String s = "temp.txt";
// see if file exists
File f = new File(s);
if (!f.exists()){
System.out.println("'" + s + "' does not exit. Bye!");
return;
}
BufferedReader inputFile = new
BufferedReader(new FileReader(s));
// read lines from the disk file, compute stats
String line;
int nLines = 0;
int nCharacters = 0;
while ((line = inputFile.readLine()) != null){
nLines++;
nCharacters += line.length();
}
// output file statistics
System.out.println("File statistics for '” + s +
“'...");
System.out.println("Number of lines = " + nLines);
System.out.println("Number of characters = " +
nCharacters);
// close disk file
inputFile.close();
} }
Program 49
// writ file on the disk
package ch6;
import java.io.*;
class FileWrite {
public static void main(String[] args) throws
IOException {
// open keyboard for input (call it 'stdin')
BufferedReader stdin =new BufferedReader(new
InputStreamReader(System.in));
// Let's call the output file 'junk.txt'
String s = "junk.txt";
// check if output file exists
File f = new File(s);
if (f.exists())
{
System.out.print("Overwrite " + s + " (y/n)? ");
if(!stdin.readLine().toLowerCase().equals("y"))
return;
}
//open file for output
PrintWriter outFile =
new PrintWriter(new BufferedWriter(new
FileWriter(s)));
// inform the user what to do
System.out.println("Enter some text on the
keyboard...");
System.out.println("(^z to terminate)");
// read from keyboard, write to file output stream
String s2;
while ((s2 = stdin.readLine()) != null)
outFile.println(s2);
// close disk file
outFile.close();
} }
Program 50
package ch6;
//Java program to practice using String Buffer class
and its methods.
import java.lang.String;
class stringbufferdemo {
public static void main(String arg[]) {
StringBuffer sb=new StringBuffer("This is my
college");
System.out.println("This string sb is : " +sb);
System.out.println("The length of the string sb is : "
+sb.length());
System.out.println("The capacity of the string sb is :
" +sb.capacity());
System.out.println("The character at an index of 6 is
: " +sb.charAt(6));
sb.setCharAt(3,'x');
System.out.println("After setting char x at position
3 : " +sb);
System.out.println("After appending : "
+sb.append(" in gulbarga "));
System.out.println("After inserting : "
+sb.insert(19,"gpt "));
System.out.println("After deleting : "
+sb.delete(19,22));
} }
Program 51
package ch6;
// Java Program to illustrate reading from FileReader
// using BufferedReader
import java.io.*;
public class ReadFromFile2
{
public static void main(String[] args)throws
Exception
{
// We need to provide file path as the parameter:
// double backquote is to avoid compiler interpret
words
// like test as t (ie. as a escape sequence)
File file = new File("C:UsersDesktoptest.txt");
//use your own paths
BufferedReader br = new BufferedReader(new
FileReader(file));
String st;
while ((st = br.readLine()) != null)
System.out.println(st);
}
}