tow method to read and write .

Ads
 

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 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); } }

Ads









Related Tutorials/Questions & Answers:
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
Advertisements
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
ModuleNotFoundError: No module named 'write-read'
ModuleNotFoundError: No module named 'write-read'  Hi, My Python... 'write-read' How to remove the ModuleNotFoundError: No module named 'write-read' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'write-read'
ModuleNotFoundError: No module named 'write-read'  Hi, My Python... 'write-read' How to remove the ModuleNotFoundError: No module named 'write-read' error? Thanks   Hi, In your python environment you
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
read/write to Windows Registry using Java
read/write to Windows Registry using Java  read/write to Windows Registry using Java
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
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 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
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
To read & write a excel file using the core java
To read & write a excel file using the core java  Hai, I'm new to JavaProgram.But now i need java program to read & write a excel file so, can anyone help me to learn the above mentioned topic(link for the portion
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
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
write a program in java to read a text file and write the output to an excel file using filereader and filewriter?
write a program in java to read a text file and write the output to an excel file using filereader and filewriter?  write a program in java to read a text file and write the output to an excel file using filereader and filewriter
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
ModuleNotFoundError: No module named 'tow'
ModuleNotFoundError: No module named 'tow'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tow' How to remove the ModuleNotFoundError: No module named 'tow' error
Java program to read a text file and write to another file
Java program to read a text file and write to another file - Creating.... Our requirement is to read a text file and then write the content of the text... and the class is used to read data from a file. The could be text file
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?   ...;stdio.h> #include <conio.h> int main() { int m, n, p, q, c, d, k, sum
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 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
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 program to calculate volume of a cube, cylinder, rectangular box using method overloading
write a program to calculate volume of a cube  write a program to calculate volume of a cube, cylinder, rectangular box using method overloading  
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
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
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
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
method
method   how and where, we can define methods ? can u explain me with full programme and using comments

Ads