0

I am a java beginner and I would like to ask question What does package stringvars means in java?

package stringvars;
import java.util.Scanner;
public class myProg{
    public static void main(String[] args)
    {
        Scanner user_input = new Scanner(System.in);

        String first_name; //packge stringvars
        System.out.print("Kindly Enter your first name: ");
        first_name = user_input.next();

        String family_name; //packge stringvars
        System.out.print("Enter your family name: ");
        family_name = user_input.next();

        String full_name; //packge stringvars
        full_name = first_name + " " + family_name;

        System.out.println("I Guess you are " + full_name);

    }

}

and also I get error when I try to run java

enter image description here

Jan Černý
  • 1,268
  • 2
  • 17
  • 31
  • 1
    https://docs.oracle.com/javase/tutorial/java/package/packages.html – Reimeus Jun 27 '18 at 15:12
  • Hello and welcome to Stackoverflow! Your question can be improved in several ways: first, the package question and error ar two diferent questions, so you should make two different post. Secondly, you shouldn"t use a picture but add a snippet of code and his error instead – Kepotx Jun 27 '18 at 15:12
  • Hmm what is the purpose of that package hihihi i just copy that source code and try to understand and run – Kaganovich Mark Jun 27 '18 at 15:19
  • 1
    To run your code try: `java -cp . kaganovich`. – sanastasiadis Jun 27 '18 at 15:22
  • Are you required to use the CMD? Or can you install an IDE? – OneCricketeer Jun 27 '18 at 15:24
  • we are required to use cmd for now in our second semester we will use netbeans Thank you for answering my question sir it helps me a lot – Kaganovich Mark Jun 27 '18 at 15:33

1 Answers1

0

Since you are declaring a package as

package stringvars;

Your java class should be inside stringvars folder. Than you can try to compile and run.

Parth Kansara
  • 189
  • 1
  • 11