
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

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

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