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
Post a Comment