Home Answers Viewqa Java-Beginners Programming Difficulty

 
 


Ron Singh
Programming Difficulty
1 Answer(s)      4 years and 8 months ago
Posted in : Java Beginners

View Answers

October 13, 2008 at 6:33 PM


Hi friend,


Code to help in read the text file and display the output :

import java.io.*;
class FileRead
{
public static void main(String args[])
{
try{
FileInputStream fstream = new FileInputStream("testdata.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}

Thanks









Related Pages:
Programming Difficulty - Java Beginners
Programming Difficulty  Suppose that a file named "testdata.txt" contains the following information: The first line of the file is the name of a student. Each of the next three lines contains an integer. The integers
Difficulty in plugging log4J with Hibernate.
Difficulty in plugging log4J with Hibernate.  I am using Hibernate 3.6. Followed your all instruction of plugging log4j with my hibernate code... log4j.properties in the class path. log4j.jar in the class path Still when I run
how to difficulty in removing error - Java Beginners
how to difficulty in removing error  import java.io.*; class skeleton { public static void main()throws IOExeception { DataInputStream data=new DataInputSTream(System.in); int p=0; //loop variables to read cell value
Difficulty using javascript in server side - Java Interview Questions
Difficulty using javascript in server side   why interaction with server using javascript is difficult
Programming - Java Beginners
Programming  I am having difficulty replacing a character in a string with two characters. There is no problem with replacing a character with another character, but with two.  Hi friend, import java.io.*; public
Programming
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
Java Programming: Chapter 2 Index
Chapter 2 Programming in the Small I Names and Things... easy, but the difficulty can be handled to some extent by giving the program... is what I call "programming in the large." Programming in the small
programming
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
Java Programming: Section 3.4
of Java programming, D is a divisor of N if N % D is zero. Let's write a program... the count This algorithm displays a common programming pattern that is used...() - 1. One more difficulty: A letter such as 'A' can occur in str in either
Java Programming: Section 8.3
be an example of generic programming. Some programming languages, such as C++, have support for generic programming. Java does not, at least not quite. We can come close to generic programming in Java by working with data structures
Java Programming: Section 11.1
pretty comical. Recursion can be used as a programming technique... about! The difficulty of following the details contrasts sharply... in the programming of recursive algorithms. Here is the corrected version of getBlobSize
Programming with JSP
Programming with JSP  Who will post me the answer
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
Programming
Java NotesProgramming Here are some tips on making programming student problems easier. Start from an existing, running, program. If you can find... of the basic elements of Extreme Programming (a much hyped, but good
Ajax programming
Ajax programming  Hi, How I can start ajax programming easily? I... concept. What should be my starting point for Ajax programming? Thanks   Hi, If you have prior programming experience in any web development
Programming with JSP
Programming with JSP  Write a program using jsp that accepts a course code as input and displays the course title the program to which it belongs
Programming (general)
Programming (general)  I haven't yet started college/university but I'm interested in studying programming. I wondering if programming is difficult or confusing with all the codes you have to learn? Also how many languages would
programming concept
programming concept  Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule
programming of foxpro
programming of foxpro  hello sir , sir i am use the foxpro . but i know about c . sir how can i learn fox pro . i know about something about foxpro
Socket Programming
Socket Programming  How to connect a computer through IP only and check whether it is up and running? I can't see any method in Socket programming where I can pass only IP address as argument. I need the pass port number also
programming error
programming error  I got an error when i did the following program the prg. is to "select the name from database when the age is given for the respective name" error i got is:SQL exception please give me the solution by providing
C Programming
C Programming  hi,how can i write a program in C programming to place reservation in air plane from the menu let the user to inter his/her gender(W or M)and draw seats by using ascii codes and choose where he/she will sit
Programming Assignment
Programming Assignment  Hey there, We were given an assignment to write a program to read 10 student marks from the keyboard without using an Array (only using switch statements, if statements or loops). As each mark is input
programming questions
programming questions  this is my assignment questions please help me... the programs in c# language Describe the following with respect to creating Web Forms in .Net environment: a. Web Form Life Cycle b. Creating a Web Form
ajax programming
Ajax Programming What is Ajax Programming? Asynchronous JavaScript and XML... is based on the HTML, Java Script, CSS, and XML. Why Ajax Programming? When you.... Easy to learn and easy to write technology. Where to Start Ajax Programming
programming problem
programming problem   Kingdom of Maplewood is a beautiful country comprising of a lot of small islands of different areas. All the islands are in a straight row. King Rosewood is getting old and has decided to divide the islands
Java Programming
Java Programming  Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the studentÃ?¢ââ??‰â??¢s programming mark. Determine how many student get A+ and A for their grade
java programming
java programming  Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the studentâ??s programming mark. Determine how many student get A+ and A for their grade and how many
programming - Java Beginners
programming for java beginners  How to start programming for java beginners
What is programming logic ?
What is programming logic ?  What is programming logic
programming - Java Beginners
Start programming in Java  Programming in Java - Can any one please suggest how to start programming in Java
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook. Exercise 9.4: The file Expr.java defines a class, Expr, that can be used
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.3 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook. Exercise 9.3: A Roman numeral represents an integer using letters. Examples

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.