+ 1
It writes "illegal start of expression ..." even if it is Wright
what to do to make it work?
8 ответов
+ 2
show your code
+ 1
import java.util.Scanner ;
class MyClass{
public static void main (String []args ){
Scanner myVar = new Scanner
(System .in);
}
}
public class Program {
public static void main(String[] args) {
int age= class MyClass (myVar );
if (age < 16) {
System.out.println("Too Young");
} else {
System.out.println("Welcome!");
}
}
}
+ 1
import java.util.Scanner ;
class MyClass {
public static void main ( String []args);
{
Scanner muVar = new Scanner
(System.in );}
public class program {
public static void main (String [] args ){
int age = myVar;
if (age > 0)
if (age > 18 )
System .out.println ( "welcome" );
}else ;{
System .out.println ( "too young");
}else ;{
System .out.println ( "error" );
}
}
}
+ 1
this is another one
+ 1
use this below code,
import java.util.*;
public class Program
{
public static void main(String[] args) {
int age = scann.scan();
if (age < 16) {
System.out.println("Too Young");
} else {
System.out.println("Welcome!");
}
}
}
class scann
{
public static int scan(){
Scanner my = new Scanner(System.in);
return my.nextInt();
}
}
+ 1
error was occur due to wrong syntax on calling a class, class Myclass is not a right style of calling a class use
just Myclass(myVar);
but there are many other errors also, thats why use my code
0
thank you mr Aditya Kumar pandey
0
thank you mr Aditya Kumar pandey