How to get the highest value using buffered reader and if statement in java




If you are new to the programming world and want to explore another method using
Buffered reader to get the highest value, together with the if statement as well, so this video will teach you how to do that, just keep watching up-to the end and you will learn something, thank you for watching. Always get up-to-date for my coming videos like this, have fun in coding. below are the codes you practice with...

import java.io.*;
public class TheHighest
 {
public static void main(String[] args)throws IOException
       {
BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter array size:");
int max =0;
int c= Integer.parseInt(input.readLine());
int[]Num = new int[c];
for(int i =0;i<Num.length; i++)
   {
System.out.println("input a number:");
int e = Integer.parseInt(input.readLine());
if(max<e)
   {
max = e;
   }
System.out.println("Maximum number is:" +max);
   }
 }
}

Post a Comment

0 Comments