23.7.2 Checking the Current version
Use the following “java” command to confirm whether Java is installed and installed version on Raspberry Pi system.
23.7.2 Checking the Current version
Use the following “java” command to confirm whether Java is installed and installed version on Raspberry Pi system.
23.7 Java language
23.7.1 Overview
Java language is a program development language developed by Oracle and is one of the most widely used development languages in the world today. Raspberry Pi also allows you to develop programs with Java language, and now you can use “1.8.0” version.
23.6.3 Saving, Compiling and Running Program
● Saving program
The created program is saved as a file. A source program written in C is stored in a file with extension of “.c”. We will store the program to “~/program_test /test_inout.c” file. Now, if you check the folder contents where the file is located, it will show the results as follows.
23.6.2 Writing Program
A typical C program usually has the following format. Header file is specified in the first line of the program. And “main” function corresponds to the body of the program.
23.6 C language
23.6.1 Overview
C language has a command structure that is easy for a computer machine to understand, and provides powerful performance. C language is a well portable program development language so that programs developed in C language can be used on all computers.
23.5.6 Learning Python Using Simple Example
● Number-matching game example
This program is an interactive, number-matching game. It allows users to match number from 1 to 99.
Here “randint” function is used to get a random number. This program will continue to run using “while” loop until the user match the number.
23.5.5 Learning Python through Game
Raspberry Pi system offers a variety of games by default. Providing games in Raspberry Pi system has another purpose for users as well as for user to enjoy games simply with Raspberry Pi system.
Providing games on Raspberry Pi system has purpose for providing a way to develop the ability to write Python programs through games. To do this, for each game, the system provide an environment that users can interact with games by Python, and users can freely edit program source code for games and execute them.
23.5.4 Running Python Program
23.5.4.1 Creating Python Program file in IDLE
If you want to create a Python program file in IDLE, use menu File àNew File. This will open a blank window, which is not an Python prompt, just an empty file. Here, you can write Python code, save it as a file, and run it. Then, the processing result appears in another window. Let’s enter the following sentence into a new window, save it as a file by using menu File à Save or [Ctrl + S], and then run it by using menu Run à Run Module or [F5] key. You can see that the result is displayed in the original Python Shell window.
23.5.3 Python Syntax
23.5.3.1 Starting Statement of Python
When writing a Python program, it is a good idea to start with “#!” (shebang). This line tells the operating system where to look for Python files. This line is not needed when executing a program within IDLE or calling “python’ command separately on Terminal, and it is necessary if the program file name is directly called and executed. It is used to allow programs to be executed regardless of where executable files of program written in Python are installed.
23.5.2 Gettting Started
The best way to learn Python for the first time is through Python IDLE. Python IDLE can be used in window or terminal environments.
23.5.2.1 Starting in the Desktop GUI environment
You can start Python using the desktop or Applications Menu.