+ 1

It writes "illegal start of expression ..." even if it is Wright

what to do to make it work?

15th Nov 2016, 10:35 AM
Amir gourari
8 ответов
+ 2
show your code
15th Nov 2016, 10:40 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 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!"); } } }
15th Nov 2016, 10:58 AM
Amir gourari
+ 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" ); } } }
15th Nov 2016, 11:05 AM
Amir gourari
+ 1
this is another one
15th Nov 2016, 11:05 AM
Amir gourari
+ 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(); } }
15th Nov 2016, 11:35 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 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
15th Nov 2016, 11:41 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
thank you mr Aditya Kumar pandey
15th Nov 2016, 4:03 PM
Amir gourari
0
thank you mr Aditya Kumar pandey
15th Nov 2016, 4:11 PM
Amir gourari