FILE HANDLING CONCEPT

Ads
 

FILE HANDLING CONCEPT

Write a program that reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been entered so far.*/

View Answers

June 14, 2012 at 4:18 PM

The given program reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been entered.

  import java.io.*;

    class StringExample
    {
        public static void main(String[] args) 
        {
            try{
            StringBuffer buffer=new StringBuffer();
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Enter strings: ");
            String st=br.readLine();
            while(!st.equals("end")){
                st=br.readLine();
                if(!st.equals("end")){
                buffer.append(st);
                buffer.append("\n");
                }
            }
            System.out.println("You have entered following strings: ");
                System.out.println(buffer.toString());
            }
            catch(Exception e){}
        }
    }

December 5, 2012 at 10:33 PM

Hi,

View the thread File Handling in Java.

Thanks

Ads









Related Tutorials/Questions & Answers:
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT   Write a program that reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT   Write a program that reads input from the console in the form of a string. When the user enters a word called end, the program should stop reading from the console and print out the values that have been
Advertisements
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT  Prompt the user to enter the name of a text file to search for. If the name does not end in a .txt extension, display an error message. Search for this file in the current directory. If the file does
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT  Write a program to read and write the details of an employee like year of joining, Department code, salary using some byte stream classes
File Handling
File Handling  how we do file handling of parsed XML code bu DOM in java
FILE CONCEPT
FILE CONCEPT  Prompt the user to enter the name of a text file to search for. If the name does not end in a .txt extension, display an error message. Search for this file in the current directory. If the file does not exist print
File handling
File handling  how do i search for an occurance of a word in a file... in a file import java.io.*; import java.util.*; class FileOperations{ public static void main(String[] args)throws Exception{ int count=0; File f
File handling in Java
File handling in Java  Hi, Can any one tell me the basics of File handling in Java? Thanks   Hi, File handling is very important... handling features in their api. You can read more at File Handling in Java
File Handling in Java
File Handling in Java  Hi, While opening a file in Java developers... was trying to find some tutorials about handling file in Java on net. I have also seen... are the use of these classes? Is there example code for explaining the File Handling
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  In a random access file, first write the alphabets a,b, c, d till z. Read the file in reverse order and print it on screen
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  Write a program that stores the names of four employees in an array of strings. Store the contents of the array in an alphabetical order in a file and display it back on console. Do not use
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  Write a program to use a File object and print even numbers from two to ten. Then using RandomAccessFile write numbers from 1 to 5. Then using seek () print only the last 3 digits
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  Write a program to write the details of an employee to a file. Details such as year of joining, department code, employee name and salary should be included. You must use RandomAccessFile
Excel file Handling in Java
Excel file Handling in Java  Hello Sir, I am new to Java, I have Started Java Core by myself. I want to make a project which include 3-4 Excel file to handle.Please explain how to read and write Excel file in Java.Is it tough
java file handling
java file handling  enter string from keyboard and then read a file if this string is present in file then print message already exists else write this string to file
java file handling
java file handling  program to get values from textbox array and the write them to text files
java file handling
java file handling  Hi friends, My situation is i have file named "sample.conf" which contains more IP Adressess.Eg: the file contains "IP=255.255.255.255" at some lines in the file. what i need to do is. i need to search
File Handling In Java
File Handling in Java In this section we will discuss about the file handling in Java. This section describes you about how to perform file handling in Java. In this section you will read what is file handling in Java, how to perform
File Handling Classes in Java
In this section, you will get to know about file handling classes in java to handle the file input output operations
Java File Handling Test Results
Java File Handling Test Results   Is somebody able to help me with this Write a program to read each name from the file and prompt the user... FileNotFoundException { new File("team.html").delete(); Scanner scan = new
Java File Handling
File Handling in Java       File Handling in Java For file handling... In a file system, it gets input bytes from a file. FileOutputStream
exception handling
exception handling  could you please tell me detail the concept of exception handling
unicode handling in java
unicode handling in java  reading a unicode text file in java
exception handling
exception handling  explain about exception handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling

Ads