0% found this document useful (0 votes)
4 views1 page

Java Input and Output Methods Explained

The document presents a Java program that demonstrates an input method for summing a series of numbers. It prompts the user to enter the number of values they wish to sum and then reads each value, calculating the total sum. Finally, it outputs the calculated sum to the console.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Java Input and Output Methods Explained

The document presents a Java program that demonstrates an input method for summing a series of numbers. It prompts the user to enter the number of values they wish to sum and then reads each value, calculating the total sum. Finally, it outputs the calculated sum to the console.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

*There are two different type of output method are there.

1)First outpur method.

import [Link].*:
import [Link].*;
class Data
{
public static void main(String args[]) throws IOException
{
int a,b,sum=0,i;
InputStreamReader r=new
InputStreamReader([Link]);
BufferedReader input=new BufferedReader(r);
String s=new String();
[Link]("Enter no of value you want");
s=[Link]();
a=[Link](s);
[Link]("Enter value for addition");
for(i=1;i<=a;i++)
{
s=[Link]();
b=[Link](s);
sum=sum+b;
}
[Link]("Sum of enter value="+sum);
}
}

You might also like