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 the purpose of nested class in java?

601


I want to persist data of objects for later use. What is the best approach to do so?

601


How to perform selection sort in java?

588


Do you need to import math in java?

566


How many types of the indexof method are there for strings?

493






Describe the various concepts related to object oriented programming (oop).

592


Can we override data members in java?

632


Can we use string in the switch case?

579


What is java literals?

583


What are the different types of garbage collectors in java?

549


Is singleton class immutable?

540


What are 5 boolean operators?

624


Can static method access instance variables ?

604


What does the append?

499


Why is the main method declared static?

588