I taught her to write code in those days 2 hello Java

Got home, I have been thinking about how to start the first lesson of it, how to make her program really interested in it, I think, losing sleep, so the next day, she saw me and asked: "Dai, you did not sleep last night do? " "
sleep ah? "I wonder how she ask.
"But you did not look like the same bed," she said, "You see your black eye so heavy."
"Really?" "Yes,
you have successfully transformed into a panda." Then she giggled Laughed.
"Yes sleep seems a bit late, in order to give you a lesson." I said.
"Wow, oh good move," she touched doing some exaggerated expression, then said, "I certainly must learn, or to disappoint you."
"I know like," I made a teacher on students look.
"Ah, the teacher worked hard." She said.
But after work, finished on the matter at hand, I gave her a micro letter: '? Do not come to class, " ."
Do not come, "she returned," I will get something Tomohiro "
." Oh, "I'm just back a word, but my heart seems to be a bit disappointed, it seems the reason is, is because I actually do not know if I have the kind of mood.
Therefore, the planned first lesson so shelved until after a few days, she was holding my laptop to the station to ask me, she said, shining on the book to write some code, but not as a book output result.
"Oh, give me a look." I said, taking her laptop.
"Well, wrote, according to the book written exactly the same." She pointed at her computer code in Notepad he said.
She wrote the code:
Here Insert Picture Description

"Yes ah, I have not started giving lessons you will write." I smiled and said, and I have a spotted a mistake she committed. But I'm going to put this obvious mistake into the final say.
"You do not install JDK?" I asked.
"JDK? What is?" She was puzzled that she came to understand random saying, "You say that ah, I installed, although I do not know what that is, but a book to say, to be downloaded and install jDK, I will follow the instructions of the book downloaded fitted with a jdk. "then, she grabbed the mouse from my hand, opened her computer's menu bar pulls out her jdk installed.
"Well, you see here." She said.
She installed on your computer java:
Here Insert Picture Description

"However, we jdk what is it? Why did it have to install it?" Then she asked again.
"Ah, you know you'll ask." I said, "jdk full name of the Java Development Kit, translated into Chinese is the Java Development Kit. It simply is writing toolbox java program needs, there are procedures used to develop java tools, java base class library and java runtime environment. " "
like, ah ... "I saw her confused look, I know she did not understand, so I think to take things a reality common to metaphor, "like to build a boat than you, you are not required to wood, you also need to saw, hammer, nails, and of course you also need a river or an ocean. here the saw and hammer equivalent in each jdk kinds of tools, lumber, nails and so is the base class library, and river or ocean is equivalent to the operating environment. " "
understand yet? "metaphor finished, I looked at her asked.
"Ah, he seemed to understand," she then said, "is not so, let the boat sail inside the river, we need to use a variety of tools to build a boat, then the boat into the river, it sailing, boat building and this process is to write programs. " "
so to speak. I did not expect so soon you can understand. "I am a little surprised at her strong understanding of.
"Ha ha, I'm not stupid, in fact, the reason I read a few days ago when he thought about, but can not determine it." She said some quite proud of.
"But I did not make the boat sail together." Then she presents some gloomily said.
"It's not there I do it." I said, "Yes, the environment variable with you yet?"
"No, the book is said to be equipped with environment variables, but I do not know what is that doing so skip a. " "
Well, well, in fact, deserve an environment variable can, but it is not convenient, as you put the tool in the family, like when you have to ship home-made, but if you bring the tools and rivers in the side, then you can ship anywhere, and then let the boat sail in the water. " "
side of the river with? "
"I mean, let jdk available anytime, anywhere on your computer, is to configure the environment variable meaning."
Here is the process of configuring the environment variables:
1. Right-click "My Computer" and click "Properties", he selects " advanced system settings ";
Here Insert Picture Description
2. select the" advanced "tab, click on the" environment variables ";
Here Insert Picture Description
then the screen will appear as shown below:
Here Insert Picture Description
in the" system properties setting three variables "in, JAVA_HOME, PATH, CLASSPATH (case it does not matter), if there is already then click the "edit" does not exist, click "New."
Variables set the parameters as follows:
variable name: JAVA_HOME
variable value: C: \ Program Files (x86 ) \ Java \ jdk1.8.0_91 // to be configured according to their actual path
variable name: CLASSPATH
variable values:;.% JAVA_HOME% \ lib \ dt.jar;% JAVA_HOME% \ lib \ tools.jar; // in front of a recall. ""
variable name: Path
variable value:% JAVA_HOME% \ bin;% JAVA_HOME% \ jre \ bin;
JAVA_HOME set the
Here Insert Picture Description
Here Insert Picture Description
PATH setting
Here Insert Picture Description
Here Insert Picture Description
Note : in Windows10 in, Path variable in a sub-section shows, we need to% JAVA_HOME% \ bin;% JAVA_HOME % \ jre \ bin; adding separate, or is not recognized:
% JAVA_HOME% \ bin;
% JAVA_HOME% \ jre \ bin;

Here Insert Picture Description
Setting CLASSPATH
Here Insert Picture Description

I have a step by step guide to her environment variable configuration Well, she was excited and said: "?. So this is ah now the program can finally output as a result of the book as"
? "Yeah,"
"No?" She asked.
"Then you try it." I said.
"Well," she said, "First you must compile and run."
Then bring up the Run command line as she wrote the book on shining, then locate the folder where the program folder, then enter the compiler command:
javac Hello.java

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

"It's strange, how to say it can not find the file?" She murmured.
"Haha, die of it."
"You laugh, quick to help me see why not do it?"
"Have you noticed that you saved the file extension is not?"
Expansion "Oh,
really smart. " "
it is! "then she changed the file extension .java, and then re-compiled with the command, this time without any problems. Then run the command input:
the Java the Hello
. "Haha, finally succeeded," she was happy almost jumped up.
After the happy, she took some sad, said: "?? While shining on the book copied code is successfully up and running, but these weird English characters What does it mean why you wrote it." "This
Well, behind repeat that, and now has been off work for a long time, oh, ah you're not hungry? "I pointed to the time displayed on the computer he said.
"Ah, are 9:00, just do not think, as you say, really hungry. To celebrate the first program I wrote to run smoothly, I invite you to eat barbecue."
"I have no opinion, ha ha."

Released four original articles · won praise 5 · Views 264

Guess you like

Origin blog.csdn.net/m0_46455711/article/details/105189753