Computer Science, asked by biswasattreyee, 11 months ago



Find the errors in the following code / expression:
int x = 1, int y = 2,
System.out.println (“The values are x" + "Y");
public class Number
void main()
int a = 0;
Scanner sc= new Scanner (System.In);
a=sc.next Double ();
System.out.println (“The value of a =" + n);​

Answers

Answered by ravikantoct2004
0

import java.util.*; [Import this package to use scanner class]

class Number

{

public static void main()

{

int x = 1,y=2;

System.out.println("The values are " x + "and"+ y);

int a;[No need to define as the base value is 0]

Scanner Sc = new Scanner (System.in);

a = Sc.nextDouble();

System.out.println("The value of a"+a); [The numbers are being stored in variable a so no need to get a new variable out of nowhere and mess up the code

}}

Similar questions