Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners FILE HANDLING CONCEPT

Have Programming Question? Ask it here!
 
 
 


SANTOSH AGRASINGH
FILE HANDLING CONCEPT
2 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners


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.*/


Advertisement
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



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 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
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
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
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
File Handling - Java Beginners
File Handling  Thanks for replying me.. but i am sorry to say...; System.out.print("Enter the file name : "); name = br.readLine(); name = "d...{ File f; f= new File(name); if(f.exists()){ RandomAccessFile rand
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 - Java Beginners
File Handling  I have written one program by which we can create a file , store any information in that,and resume that file using a user name and password.now my problem is that whenever i write datas into the file the previous
file handling - Java Beginners
file handling  assume two files are there- 1. with the quanity of he... manner. now write a progam in java and create another file which is having the amount required to purchase each item and at last read the newly created file
File Handling - Java Beginners
File Handling  Q. Write a java prg which accepts a list of existing text files from command line args & concatinate contents of all files...(e.getMessage()); } } }   its prg of copying file Check code
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
exception handling code for file not found error..
exception handling code for file not found error..  How to do exception handling for file not found error
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
PHP File Handling
PHP File Handling: Every language supports File handling, file handling has... file handling. PHP supports this feature using the following functions: i)    fopen: To open a file in a particular mode, like r: read, w
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
IO concept
file to another and deletes the old file.   Hi Friend, Try...[] args) throws Exception { File f1=new File("C:/data.txt"); File f2=new File("D:/data.txt"); BufferedReader br=new BufferedReader(new
Java file not found exception
Java file not found exception This section illustrates you the concept of file not found exception. Java provides a powerful concept of Exceptions... by a code. When a file with the specified pathname does not exist, file not found
Java file exception
Java file exception This section illustrates you the concept of file exception... the concept of file exception. Output: java.io.FileNotFoundException... or it is generated by a code.  In the given example, we have specified a file
Explain normalization concept?
Explain normalization concept?  Explain normalization concept
Java file object
Java file object This section demonstrates you the concept of File object... the programming much easier. Here we will discus the operations performed by File object. Using the File object, you can perform several operations. It parses
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
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
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Concept of subqueires using JSP
Concept of subqueires using JSP  Can I implement the concept of sub queries in JSP page , if yes please tell me how this can be achieved. I have requirement where output of the SQL query should be given as input to the update
session concept - JSP-Servlet
session concept  Hello friends, How can we track unexpectedly closing a window when a jsp project running with session concept. And this tracking should update the log in status in data base
Concept error - WebSevices
Concept error  What is the difference between Joomla And Zend framework. Any one know the answer  Hi friend, Joomla CMS is a multi... for many types of backends, such as memory or a file system. Thanks
Session concept - JSP-Servlet
Session concept  Hai friends, I am doing a jsp project with session concept. If one person is not accessing his logged window for more than 10 minutes it gets automatically log out.Anybody explain me the reason
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
 

 

 

DMCA.com