Home Answers Viewqa Java-Beginners tow method to read and write .

 
 


sam
tow method to read and write .
2 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

i have two method , frist named "readString" which has no input ,and output b type string ,. second method named "writeString" which accept b as imput and return nothing .........please i want solution this program ....help me please

View Answers

December 20, 2010 at 1:12 PM


Hi Friend,

Try the following code:

import java.util.*;
class  Methods
{
    public String readString(){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter String: ");
        String st=input.nextLine();
        return st;
    }
    public void writeString(String st){
        System.out.println("You have entered: "+st);
    }
    public static void main(String[] args) 
    {
        Methods m=new Methods();
        String str=m.readString();
        m.writeString(str);
    }
}

Thanks


August 1, 2011 at 7:50 PM


import java.util.Scanner; public class test { public static void main(String[]args) { Scanner scan=new Scanner(System.in); System.out.println("1st digit..."); int x=scan.nextInt(); System.out.println("1st digit..."); int y=scan.nextInt(); int z=x+y; System.out.println("Sum="+z); } }









Related Pages:
tow method to read and write .
tow method to read and write .  i have two method , frist named "readString" which has no input ,and output b type string ,. second method named "writeString" which accept b as imput and return nothing .........please i want
Read Write
Read Write  Hi; How can I read certain line of say 10 text files and write to one text file   Java Read Multiple Files and store the data into another text file The given code reads all the text files of the directory
Read and write file
Read and write file  HI, How to read and write file from Java program? Thanks   Hi, See the following tutorials: Java Write To File Read File Thanks
read and write a file using javascript
read and write a file using javascript  How to read and write a file using javascript
is there any possibelities fast read and write file large data file
is there any possibelities fast read and write file large data file  ...) { //read from start original file String arry[] = sCurrentLine.split...); String delimeter=","; System.out.println("call prepareGroupBy method
is there any possibelities fast read and write file large data file
is there any possibelities fast read and write file large data file  ...) { //read from start original file String arry[] = sCurrentLine.split...); String delimeter=","; System.out.println("call prepareGroupBy method
is there any possibelities fast read and write file large data file
is there any possibelities fast read and write file large data file  ...) { //read from start original file String arry[] = sCurrentLine.split...); String delimeter=","; System.out.println("call prepareGroupBy method
how to write and read text for javaME
how to write and read text for javaME  Hi. I have tried ur read/write coding but why i didnt get the o/p just like urs. do i have to add anything from the library? i want to type multiple line on text file then, read it from
Java file read write operation
Java file read write operation  how to read and write the data from text file.Suppose i have text file with 4 fields name ,roll no ,marks1,marks2 with more than 20 records......i need to store these value in object and pass
Use of write method of CheckedOutputStream class in java.
Use of write method of CheckedOutputStream class in java. In this tutorial, we will discuss the use of write(int b) method of CheckedOutputStream class... and calculate checksum value. The write(int b) method is used to write a bytes
write a progam for bubble sort using file read nd write?
write a progam for bubble sort using file read nd write?  hi, please give the code
how to read and write an xml file using java
how to read and write an xml file using java  Hi Can anyone help me how to read and write an xml file which has CData using java
how to read and write xml files in javascript
how to read and write xml files in javascript  hi m very new to javascript and xml,, now i want to read and write xml files in javascript,, please give me a sample code to do
How to write method for UITableView didSelectRowAtIndexPath?
How to write method for UITableView didSelectRowAtIndexPath?  Hi, Please tell me how to write method for UITableView didSelectRowAtIndexPath? Thanks   HI, Here is the code: -(void)tableView:(UITableView *)tableView
J2ME RMS Read Write
J2ME RMS Read Write       This Application specially tries to explain how to read and write the data using RecordStore class. In the RecordStore class the following methods
Write to a file
Write to a file       As we have read about  the BufferedOutputStream class that store the data in an internal buffer and lets you write
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
add tow numbers with out using arthamatic operaters
add tow numbers with out using arthamatic operaters  add tow numbers with out using arthamatic operaters
Write a MoveFirst() for Circular Linked List
Write a MoveFirst() for Circular Linked List  write a MoveFirst(T elt) method to point the head at that element. Then the tail would point...); it should read "two three four one
class method in java
class method in java  How to write a class method in Java?   You must read Java - Class, Object and Methods in Java
Write Text into File
in which we are writing string by use of write() method. We need  java.io.... into an object of  Writer class .Then we are using write() method to write text into file. At last close output file using close() method
JavaScript write to text file
a TextStream object to read from or write to the file. The Boolean value defined... to write the text into the created file, we have used WriteLine() method. This code... JavaScript write to text file  
How i write a function/method in jsp?
How i write a function/method in jsp?  How write the function/method in jsp? Using that method i can retrieve the value coming from database. give me example plz. Actually i want to show the list of user detail
simple code to write an read and write the login detail to a xml file using javascript ( username and password )
simple code to write an read and write the login detail to a xml file using javascript ( username and password )  pls can nyone give me a code to write and read the login details (username and password )into a xml file using
How to make a file read-only
the write permission of the same file. The method createFile creates a file with a specified name and setWritable(false) revoke the write persmission.. The method canWrite() returns booleasn value which whether the file is write-able
Class and method question, Java?
then returns the value read. a. Write preconditions and postconditions for the method...Class and method question, Java?  Consider a Java class that you... Prompt string** and the following method: getValue displays the prompt and reads
can we write a method in JSP - JSP-Servlet
can we write a method in JSP  Hi All, In my web application I want... a class's method() from jsp and I can come back to the next instruction of jsp... write you requirement clear then i can able to give ans. thanks rajkumar
Write a C language program to read two matrices and multiply them?
Write a C language program to read two matrices and multiply them?  Write a C language program to read two matrices and multiply them?   Here is an example of multiplying two matrices using C language. #include <
Display tow dimensional array using one for loop in java
Display tow dimensional array using one for loop in java  Display tow dimensional array using one for loop in java
How to make a file read-only in java
a file read-only by using file.setReadOnly() method of File class. After using this method, you will not be able to write or edit into the file.  Here...(); method is used. In the page you learned how to make a file read only
What is the best way to write to file in Java?
;Read the tutorial at Java Write To File - Java Tutorial. Thanks...What is the best way to write to file in Java?  I am creating a program in Java which writes into a text file. What can be the be best method
Write Text File to Table
Write Text File to Table       In this section, you will learn how to read the records of a simple text file and write (insert) into a simple table in MySQL
How to read big file line by line in java?
of an array. readLine() - This method is used to read a complete line...Learn how to write a program in java for reading big text file line by line In this tutorial I will explain you how you can read big file line by line
Ajax Write
Ajax Write       ajaxWrite is a web-based word processor that can read and write Microsoft Word and other standard document formats Read full Description
Java Write To File - Java Tutorial
by the BufferedWriter stream. The write( ) method of BufferedWriter class is used to create... of OutputStreamWriter class that is used to write text (as opposed to binary data... an internal FileOutputStream to write bytes to the specified file
Display tow dimensional array by matrix form using one for loop in java
Display tow dimensional array by matrix form using one for loop in java  Display tow dimensional array by matrix form using one for loop in java
Java Read File Line By Line, Video Tutorial of Java Read File Line By Line
() method to read one line at a time from input stream. The readLine() method...() method is used to close the input stream. read() - The read() is used to read... is very useful and it is used to read one line at a time. Other method of reading
Read from file java
Read from file java  How to Read from file java? What is the best method for a text file having a size of 10GB. Since i have to process the file one line at a time so tell me the very best method. Thank you
Read Multipart mail using Java Mail
Read Multipart mail using Java Mail       This Example shows you how to read a multipart message using javamail api. When we read a multipart mail firstly create
Please write code for this program in java and Explain it ? pl'sssssssss
that were ever alive at one time. Write a method to compute this, given the above array of 2n integers. Write one of the following methods: C/C++: int...Please write code for this program in java and Explain it ? pl'sssssssss 
Write String in Word document
Write String in Word document  How to read and write strings in word document
Java error cannot read
Java error cannot read       The Java error cannot read occurred when a programmer do.... For this we have a class ErrorcannotRead.In the main method we create
Write a byte into byte buffer at given index.
ByteBuffer putChar(int index, byte b) The putChar(..) method write.... abstract byte get() The get() method read byte from current... Write a byte into byte buffer at given index.  In this tutorial, we
Read the File
the data is read in form of a byte through the read( ) method. The read... Read the File       As we have read about  the BufferedInputStream class
Use of rewind method in java.
again read the buffer. The method allocate( int capacity) ...;write both, but stream can either read-only or write-only... with this file input stream. The read() method of FileChannel 
How to write the given byte into byte buffer.
. abstract ByteBuffer put(byte b) The put(..) method write... byte get() The get() method read byte from current position... How to write the given byte into byte buffer.  In this tutorial, we
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?
how to read 100 text files from a folder or directory and write the data... column value that keeps on changing for every file.i have read the data from all the files and write them into a single file..the target file should have the 1st
Java Write To Image File Example
ImageIO's  write() method in different format. ImageIO.write... images using write() method of ImageIO class that takes three parameters...Java Write To Image File Example To Write Image in different format you may
write java prgram
write java prgram  write java program to offer a menu which contains 3 choices to make calculation on 3 shapes.use method for each calculation
read string - using loops in Java
read string - using loops in Java  Write a program to read a string composed of an unknown number of words, then count the number of words in the string, and Display the longest and shortest words, with first letter Uppercase

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.