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



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sam
tow method to read and write .
2 Answer(s)      3 years and 11 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


Advertisement
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 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
read and write a file using javascript
read and write a file using javascript  How to read and write a file using javascript
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
read/write to Windows Registry using Java
read/write to Windows Registry using Java  read/write to Windows Registry using Java
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 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 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
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
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
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 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
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
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?   ...;stdio.h> #include <conio.h> int main() { int m, n, p, q, c, d, k, sum
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
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
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
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
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
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
How to Read file line by line in Java program
Reader and readline() method one can read the data faster even on the computer... line. The other methods that can be used are: read() method of BufferedReader... a specific file. If they are not buffered every time a read() method or readline
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
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
Advertisements
 

 

 

DMCA.com