For my son who started studying Java with "Introduction to Java" in one hand

Preface

My son said, "I want to study programming," so I gave him an on-boro PC that was lying around at home, saying, "What should I do?" And "Introduction to Java." (Terrible) That's not enough, so I thought I'd read about "Introduction to Java" again and summarize what I was interested in and what I shouldn't do.

[Introduction to Java](https://books.rakuten.co.jp/rb/14782914/ ()

Refusal

――The target is my son ――It's just an individual impression ――We have the first edition of the first edition

P.18 1-1-4 Flow of Java execution

There was a time when it was said that the processing speed was slower than the language that generates and executes a machine language program that the CPU can understand, such as C language.

It has improved to a speed comparable to C language.

People, people, people, people > Sudden C <  ̄Y^Y^Y^Y^Y ̄

I'm sorry, I wanted to try it once.

Joking aside, I was a little wondering what percentage of beginners and beginners who picked up this book were experiencing the C language. I'm not afraid that this kind of thing no longer acts as a counter to the discourse that "Java is slow", which is still being said by some.

P.19 1-2-1 Java installation

Is it Windows only? This kind of thing is mostly Windows only, Mac only, or both. People who use other than that are at their own risk, aren't they? It was a complaint of using Xubuntu.

The PC I gave my son had Xubuntu 08.04 installed, and JDK6 (!) And Eclipse (about 3.3?) Were already installed, so I think this area is through.

P.32 2-1-4 Operator

Logical operation and bit operation

Arithmetic and relational operators can be understood with knowledge of arithmetic, so can logical operations and bit operations be written lightly and make sense? No, is it natural that a person who wants to learn a programming language understands the basics of computer science? Then where and how should I learn it? Toka Toka. When I read the introductory book again from the perspective of having beginners read it, I suddenly start to notice what I had passed by without worrying about anything. In that sense, it's awkward for my son, who wants to study programming, to suddenly hand over "Introduction to Java" and read it.

Digression

Therefore, the evaluation that "'○○○○' is recommended for beginners" may be seen from above, so I feel that you should not be blind. In the sense that what you take for granted may not be for others.

P.37 Operators used for string concatenation

Many operators are used to calculate numbers and booleans, but the binary operator "+" and the assignment operator "+ =" can be used to combine strings.

I think it's worth mentioning that the String type is specifically specified in JLS. (Chapter 7 mentioned the String type in detail, but it didn't seem like that either.) I sometimes see the String type being treated specially (not just because of that) and the lack of understanding of it causing unnecessary confusion.

P.42 while statement / do ... while statement

No, aside from the story that I haven't written while recently, in the explanation of break

It is convenient to describe in this form, especially when the conditions for terminating the loop are complicated or when there are multiple conditions.

There is, but if you are not careful, you can see the future of becoming a spaghetti code. Well, how to solve it may be a little further.

P.45 2-2-1 Class Declaration

Does the student have MAX_SCORE?

Digression

No, it's difficult to express the essential things with a simple sample code, isn't it? I also have the experience of being a lecturer at an in-house study session on object-oriented programming and died in a big explosion, so I understand it painfully. I remember now and my chest hurts.

P.49 2-2-5 main method

Does the main method come out at this timing? I wonder if it's better earlier. I thought, but then it's surprisingly difficult to think about where to put it. At the time of Hello World, I think it's possible to say "everything starts from main" for the time being, but I think that chapter is probably going to be done without explaining anything. ..

Very digression

In reality, I don't think there are quite a few people who write Java programs at work who have never written the main method ... That's horrible.

P.59 2-4-2 Do not add _ after the variable name

Therefore, it is no longer necessary to add "_" after the variable name.

I fully agree with that claim, but was this a notable major culture? Personally, I've occasionally seen local variables (methods) prefixed to "before" (often not limited to Java), but you may not have seen a trailing underscore.

P.63 3-1-2 Primitive type

Primitive types are basic data types consisting of boolean types, numeric types, and character types.

No, I think there are only boolean type and numeric type. char is an "integer" that stands for UTF-16, isn't it? cf. https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.2

Digression

For convenience, I think it is possible to say "character type".

P.66 3-1-3 Reference type

The String type is used in the new example, and I thought that I didn't have to use the String type depending on what happened there, but after that

You can use the new keyword to instantiate a class, but for the String class you can use string literals to instantiate more concisely.

Did you want to connect to the explanation of this string literal?

P.106 Chapter4 Mastering arrays and collections

In this chapter, we will talk about Java arrays and collections that you just know about.

No, I don't really have anything to do with it, but I was struck by the expression, "I just knew it." Also, when I say that, I feel that it is not limited to arrays and collections.

P.109 4-1-2 Initialize the array

Note that the [] used to declare an array can be attached to a type or a variable. That is, you can write either an int [] array or an int array []. However, the former int [] array is recommended so that you can clearly see that it is an "int array".

It is written in JSL that this is a little more in-depth. cf. https://docs.oracle.com/javase/specs/jls/se8/html/jls-10.html#jls-10.2

Variables are attached because of their affinity with C and C ++, and although you can write something like int [] array [], it seems that it is not recommended.

Afterword

Due to time constraints, we will stop here.

Of course, there are a lot of things that I like in "Introduction to Java", so I thought it was necessary to make an effort to spread those things together. Let's do it with next year's Advent Calendar.

Recommended Posts

For my son who started studying Java with "Introduction to Java" in one hand
[For beginners] Minimum sample to update RecyclerView with DiffUtils in Java
Introduction to java for the first time # 2
Introduction to algorithms with java --Search (breadth-first search)
[Java] How to test for null with JUnit
Links & memos for getting started with Java (for myself)
Introduction to algorithms with java --Search (bit full search)
Getting started with Kotlin to send to Java developers
One way to redirect_to with parameters in rails
An introduction to Groovy for tedious Java engineers
[Introduction to Java] Basics of java arithmetic (for beginners)
Things to watch out for in Java equals
[Java] Introduction to Java
Introduction to java
A study method for inexperienced people to pass Java SE 8 Silver in one month
[Java] A quick introduction to integration testing with Selenide + Chrome Driver <Updated in May 2020>
How to call functions in bulk with Java reflection
Things to watch out for in future Java development
[For beginners] Minimum sample to display RecyclerView in Java
Get started with "Introduction to Practical Rust Programming" (Day 3)
Introduction to Java for beginners Basic knowledge of Java language ①
Try connecting to AzureCosmosDB Emulator for Docker with Java
A rock-paper-scissors game for two players who play against each other in threads with Java
[Java] A technique for writing constructors, getters, and setters in one shot with IntelliJ IDEA.
Introduction to java command
To you who suffer from unexpected decimal points in Java
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
An introduction to functional programming for object-oriented programmers in Elm
Investigated how to call services with Watson SDK for Java
How to change arguments in [Java] method (for those who are confused by passing by value, passing by reference, passing by reference)
[Java] How to search for a value in an array (or list) with the contains method