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



Home Answers Viewqa Java-Beginners Java Programming Question
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Soummya Kanti Ghosh
Java Programming Question
1 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


Write a program in Java to accept 10 different numbers an store it in text file.


Advertisement
View Answers

January 28, 2011 at 10:34 AM


Hi Friend,

Try this:

import java.io.*;
import java.util.*;
class AcceptNumbers{
    public static void main(String[] args)throws Exception{
        Scanner input=new Scanner(System.in);
        BufferedWriter bw=new BufferedWriter(new FileWriter(new File("C:/numbers.txt"),true));
        for(int i=1;i<=10;i++){
        System.out.print("Enter Number "+i+": ");
            int num=input.nextInt();
            bw.write(Integer.toString(num));
            bw.newLine();
        }
        bw.close();
        System.out.println("Numbers are store into the file");
    }
}

Thanks



Related Tutorials/Questions & Answers:
Java Programming Question
Java Programming Question  write a program in java to show thread working with sleep and wait method   Hi Friend, Please visit the following links: Wait Method Sleep Method Thanks
programming question - Java Magazine
programming question  I have an SGVT map displaying on a phone emulator but then want to search for a given location on the map and display... tool. I need a java solution to this please
Advertisements
Java Programming Question
Java Programming Question  Write a program in Java to accept 10 different numbers an store it in text file.   Hi Friend, Try this: import java.io.*; import java.util.*; class AcceptNumbers{ public static void main
Java Programming Question
Java Programming Question  Write a program in Java to create a menu bar with the help of event handlers.   Hi Friend, Try this: import javax.swing.*; import java.awt.event.*; public class SwingMenuBar{ public
Java Programming Question
Java Programming Question  Write a program in Java to create student information form an submit detail in database.   Hi Friend, Try this: import java.awt.*; import java.sql.*; import javax.swing.*; import
core java programming question
core java programming question  How to write a java program to list the customer names arrived to a restuarant on a particular date in alphabetical order with arguments as 1 filename yymmdd cust   Hi Friend, Try
programming question - Java Beginners
programming question  Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion Picture Association of America (MPAA) rating (eg., Rated G, PG-13, R), ID Number
Java programming question - Java Beginners
Java programming question   Give the definition of a class named Doctor whose objects are records for a clinic's doctors. This class will be derived class of the class SalariedEmployee that is given below the question. A Doctor
Java programming question - Java Beginners
Java programming question  I want to write a program that converts temperatures from celsius to fahrenheit and vice versa. It also converts kilometers to miles and vice versa using "methods".  Hi Friend, Try
socket programming question
socket programming question   can you respond to me the multiple clients chat application java code and a server that manages the clients using the socket programming in java
socket programming question
socket programming question   can you respond to me the multiple clients chat application java code and a server that manages the clients using the socket programming in java
socket programming question
socket programming question   can you respond to me the multiple clients chat application java code and a server that manages the clients using the socket programming in java
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
Question in Java ??
Question in Java ??   Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number squrfoot
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
Question on java
Question on java  why java is not purely oop?   java is not purely OOP because 1.) Multiple Inheritance is not supported. 2.) It uses primitive data type. 3.) static method can be called without creating instances
Question Java>?
Question Java>?  **√Į‚??¬∑ Create a new class called Bank and in the main method use class Account (lab 4) to create an array of 10 accounts. √Į‚??¬∑ Enter data for all accounts (account number,name, balance). √Į‚??¬∑ Add
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 question
java question   Create a class called Complex to perform arithmetic operations with complex numbers. 1- Use double variables to represent the fields of the class. 2- Provide a no-argument constructor with default values in case
Java programming
Java programming  What is the Role of OOP in java
Java programming
Java programming  What is the Role of OOP in java
java question :)
java question :)  write java program to use vector in ArrayList with add, remove,sort   import java.util.Vector; public class... Element MUAYAD"); vc.add("Vector Element JAVA"); vc.add("Vector Element
programming java qus.
programming java qus.  write a import statement that import all the inner class of outer class .outer class must not be imported??   You must not ask similar question more then once. If it happens the user id
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
Java programming - Java Beginners
Java programming  hi sir, my question are as follows... hope u can solve my java programming problem.. Write a program to develop a class to hold... to : http://www.roseindia.net/java/beginners/index.shtml Thanks
programming - Java Beginners
programming for java beginners  How to start programming for java beginners
java programming
java programming  how to write a coding for simple login form in netbeans
JAVA PROGRAMMING
JAVA PROGRAMMING  Write an OVERLOADED FUNCTION in java that swaps(interchanges) 2 user given numbers.(one integer and one float value) and displays the result after swapping. Invoke the function in a class
Java Programming
Java Programming  Using Java Frame form, help me develop a GPA calculating device, able to show Grade and points together, and using MySQL database
Java Programming
Java Programming  Using Java Frame form, help me develop a GPA calculating device, able to show Grade and points together, and using MySQL database
 

 

 

DMCA.com