Computer Science, asked by juhiiii6567, 1 year ago

An error message should include the cause of the error and possible solution to get rid of the error.

Answers

Answered by saikatguchhait077
0

Here is a simple program with simple error....---->


import java.util.*;

public class rep

{

   public static void main(String []args)

   {

       int i=1;

       System.out.println("Enter Odd or Out number:")

       i=s.nextInt();

......

Here Error is: ' ; expected .'

--->System.out.println("Enter Odd or Out number:")

where semicolon must be at end like this ---->

System.out.println("Enter Odd or Out number:") ;

and


2nd Error is : 'Reached at end of file while parsing...'

in the last line-->  i=s.nextInt();

Solution :

}

}

3rd Error is : 'Cannot find the Variable s'

in last line --->  i=s.nextInt();

---->>>So the total program to get output is :

import java.util.*;

public class rep

{

   public static void main(String []args)

   {

       Scanner s=new Scanner(System.in);

       int i=1;

       System.out.println("Enter Odd or Out number:");

       i=s.nextInt();

   }

}


Similar questions