In: Computer Science
Create your own Java program that has all three of these components in its design:
The code for the above program is given below and comments are added in code for your understanding:
import java.io.FileInputStream;
public class MemberTest {
public static void main(String[] args) {
///example of fileinput
try{
FileInputStream input=new
FileInputStream("filehello.txt");
int i=input.read();
System.out.print((char)i);
input.close();
}catch(Exception e)
{
System.out.println(e);
}
//example of file input ends
}
//this is the method which return some value
public int valueReturning()
{
return 8;
}
//this is the method for void
public void hello()
{
System.out.println("Hello from
void");
}
}
Please refer to the screenshot of the code for identation of the code:
Thank You!