java - Why i am getting error saying illegal start of expression at public class Name{ -


define string variable named firstname stores name. set value name question , code follow:

    public class name{   public static void main(string[] args){     console console=system.console();     string firstname="bhawani";     console.printf("heloo name %s",firstname);     console.printf("%s learning java",firstname);   } } 

you have spelling mistakes, however, here's updated version of code should run.

public class name{ public void main(string[]args){     console console = system.console();      string firstname = "bhawani";     console.printf("hi, name %s", firstname);     console.printf("%s learning how write code in java", firstname);    } } 

you should make sure check code correct before asking questions :)

you mispelt:

system.consol(); console.printf("%s learning how write code in java", firstname); 

also, should note using console return null unless application runs through terminal. instead can use "system.out.print", seems solve problem.

system.out.printf("hi, name %s", firstname); system.out.printf("%s learning how write code in java", firstname); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -