0.Opening Jinglebe-le ♪ Jinglebe-le ♪ The bell rings- ♪ As the world makes a fool of people and the rear charge spreads to popular spots, I would like to make Christmas Eve a fun Christmas Eve by interacting with Java ♂. Take off ~~ d ... ~~ Kuribocchi!
That said, I don't know Java yet, so I took a quick look at Java.
Originally, it was created around 1991 by Sun Microsystems, Inc. of the United States (now absorbed by Oracle) as a programming language for software development for home appliances. From there, improvements were made, and Java was announced at SunWorld in 1995. The reason why Java got a lot of attention was the ability to develop small programs called "applets" that run on Web browsers. For this reason, it was once misunderstood as "a language for the Internet for making applets." ** Java is a "general-purpose programming language that can also create applets" and is a versatile language **. That is the concept.
--Provided free of charge --Once created, it can be executed anywhere --Syntax similar to C or C ++ --Support for object-oriented programming --A lot of multifunctional libraries --Concurrent processing --Classification by package
The textbook that will be taken care of this time is "Clear Java -Introduction-" written by Professor Nobuhiro Shibata. Onacious!
Use eclipse, an IDE (Integrated Development Environment).
I can't get the screenshot, so I can get the source code instead.
package Sample;
//画面に表示を行うプログラム
public class SampleA {
public static void main(String[] args) {
System.out.print ("Hello!"); // printf ("Hello!") In C language;
System.out.print ("X'mas" + "EVE !!"); // Character concatenation
System.out.println ("Rear charge ... \ n Blast !!!"); / * \ n is a line break as in C language. You can put it between character literals! * /
}
}
package Sample;
// Library in C (like #include <stdio.h>) import java.util.Random; // Library for generating random numbers import java.util.Scanner; // Library for accepting keyboard input
public class SampleB {
public static void main(String[] args) {
//ライブラリにある関数を使いやすく定義 Random rand = new Random (); // The one with the same role as the rand function in C language Scanner stdIn = new Scanner (System.in); // Same role as scanf in C language
int a;
a = 2;
int b = -1;
double x = 1.5 * 2;
final double PI = 3.14159; // Variable whose value cannot be rewritten (const in C language)
x = rand.nextDouble();
// The value in parentheses is the value after calculation (printf ("% d", PI * x * x) in c language) System.out.println (The area of a circle with "radius" + x + "is" + (PI * x * x) + ".");
System.out.print ("value of integer a:");
a = stdIn.nextInt();
System.out.println("a / 2 = "+ a /2);
System.out.println("a % 2 = "+ a % 2);
String s = "cake"; // String type (char type array in c language)
System.out.println ("The string s is" + s + ".");
}
}
Java has a longer syntax than C language, and the syntax may be different from C language, so I felt a little uncomfortable. However, the input assistance is excellent, and I am grateful that you do not have to hit each time if you use the Tab key. Also, I found it interesting to be able to connect characters. (Because it was like "I hava a pen. ♪ I have an apple. ♪ Oh, Apple Pen. ♪" of a certain PPAP (laughs)) 6.Ending I tried to interact with Java, but this time it was the beginning of the beginning, and I could not touch the true value of Java. However, not only this time, I would like to continue to deepen exchanges with Java. Well, seriously aside, thanks to Java, I have good memories that are comparable to Ria Mitsuru. (maybe) … Is it going to go to the mouse country alone from now on?
Recommended Posts