Hi Cherry:
First two things, by intention we ask everyone to provide their Real Names here for use in the forum.
We aren't generally discussing how to obtain Banned Substances on the Dark Web or how to hide a body after a murder, so that shouldn't usually be a problem.
The rationale behind this is discussed here:
https://coderanch.com/wiki/718810/CodeRanch-naming-policy
Also, tho in this case the code is so simple it didn't make much difference to me personally, you are going to want to get used to using "Code Tags" correctly:
https://coderanch.com/wiki/659781/Code-Tags
When you do that, you will find way more people read your code and are likely to have helpful responses to contribute.
Anyway, the reason you came here, "What's going on with compiling at the command line??"
This is one of the more annoying parts of studying for the OCA or OCJP exams.
In "Real Life", you don't do all that much compiling from the command lines, but it is an important part of basic
Java knowledge and is probably still covered on the exam.
At least on the OCJP, command line stuff without modules isn't any more, I think, but whatever. Check your reference sources for whichever exam you are preparing for, and this is pretty basic stuff anyway.
So let's get this right for now and most of the rest of everything you are studying will be more Practical, more Theoretical, and more Fun.
There are two ways of compiling stuff (without modules) from the command line.
One is using the "-d <directory>" option which I daresay is the more common.
This will place all your .class files under the <directory> that you specify, respecting the package names.
You are not using this form right now, so both the compile and run steps are very sensitive to where you are sitting in your directory structure when you issue them.
If you don't use the "-d <directory>" option, then each .java file you compile will generate a .class file in that exact same directory the .java file sits in.
So given your example, the following will work (I know because I tried it) from my PowerShell prompt, creating directory Demo on my F: drive where I keep all code:
PS F:\> javac demo/food/Fruit.java
PS F:\> javac demo/test/Apple.java
PS F:\> java demo/test/Apple
Hello, im Apple extends Fruit !
Note that when you are doing things this way you specify the full path in terms of package name to both your .java files and your .class file
There are other things to know about compiling from the command line, but let's see if doing just this works for you so far.