How can you take string into InputStream?

Answer Posted / himanshu gupta

String str="";
int i=0
InputStream in=new FileInputStream("File url");

while((i=in.read())!=-1)
{
str=str+(char)i;
}
System.out.println(str);

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is quick sort in java?

773


Do we have pointers in java?

708


Is string is a data type?

734


What is the loop in java?

784


Differentiate between a constructor and a method? Can we mark constructors final?

927


When is the garbage collection used in Java?

852


Is there a sort function in java?

749


What is the finalize method do?

806


What do you understand by the term singleton?

761


What is the difference between static and non-static variables in java programming?

692


Is integer immutable in java?

730


What is local declaration?

682


What is garbage collector?

808


What is use of inner class in java?

739


What is indexof in java?

729