Aiming to acquire Java Oracle Silver, point memo (pass)

What about this article?

As the title says, it will output the learning content with the aim of acquiring Java Oracle Silver. Specifically, I will try to solve the so-called black book and describe the place where it gets stuck in this article. Therefore, please note that it is a memorandum for yourself rather than an article.

(2019/9/28): The description has been changed a little. (2019/10/29): Passed

Textbook: Thorough capture Jaca Silver SE8

passed

Actually, I received it around the middle of the year ... The update was delayed. The correct answer rate was ** 91% **. Is it an easy victory ...?

As for the impression, ... ** "Problem collection, that's right ..." ** is a straightforward impression. No really. I didn't have enough time to review what I made a mistake the day before or just before, but I didn't get anything like a hook, and the answer options didn't change. I think.

Just one point, if you tell the recipient from now on, ** Be careful not to be confused by the variable name etc. ** ** Regarding the variable name, the method of assigning it is different from the problem collection ... So when you see the first question, you may be impatient with an unfamiliar variable name (I was confused for a moment). But that problem, I just did it in the problem collection! If that happens, I think it will be easier to solve, so please take it with confidence.

To be honest, the standard is 70% for the two summarization problems, and I think that all you have to do is review the mistakes. If there is something you don't understand, use the purple book. If you don't have the time, I recommend buying a Kindle and reading it on the train. I think it depends on the person, but for reference.

All classes belong to the package

Catch point: "Some classes do not belong to the package" is incorrect

Although you can actually omit the description of the package, in that case ** it belongs to the anonymous package **, so the word ** does not belong to the package ** is not appropriate and incorrect.

Supplement

You can only access anonymous packages from similar anonymous packages. Note.

Static import needs to describe variables and methods

Catch point: Unlike normal import statements, it is necessary to describe the variables and methods you want to use when importing statically. At that time, do not add ** () **.

An example is shown below.

☓:import static hoge6.ClassName.method() ○:import static hoge6.ClassName.method → This is the same for variables

Supplement

What is static import in the first place? → ** A way to simplify calling external static members ** For example: ○ No static import

return Math.pow(4, 3)

○ With static import

import static java.lang.Math.pow;
return pow(4, 5)

"Execution environment including JVM (runtime environment)" is required to execute Java bytecode

Getting stuck: You don't need a compiler if you have a compiled class file

If the question is Java source code, you need a compiler, but if it's bytecode, you don't.

Supplement

What is Java bytecode? Intermediate code generated after compiling Java source code I remember that I don't need a compiler because it shows the code that has already been compiled after all.

Byte, short, int, char can be used in the switch statement, and these reference types + String type

Catch point: Pay attention to the case statement type of the switch statement in question (whether it is a numeric value, a single character, or a character string)

Below is a list Primitive type: byte, short, int, char Reference type: Byte, Short, Interger, Character, String

The order of access range of modifiers is [public> protected> unlisted> private]

Caught point: Somehow unstated> Be careful to think protected

Do you misunderstand that protected doesn't see much from the feeling of letters ... The access range is as follows

Access modifier Access range
public No limit
protected Only from the same class and subclass
No description Only from the same class and the same package
private Only from the same class

The second column of the associative array can be reinitialized

Catch point: An example is shown below, but no compilation error occurs.

You can do the following

//Three arrays are created, in which an array of length 5 is created.
int[][] array = new int[3][5];
//Such an image →[new int[5], new int[5], new int[5]]

//Initialize it
//Even small ones
array[0] = new int[1];
//Large ones
array[1] = new int[7];

//result
// [new int[1], new int[7], new int[5]]

Implicit type conversion is conditional on "no data loss" after conversion

Catch point: Even if there is a value with no data loss after conversion, a compile error will occur.

int in = 5;
double do = 10.5;

//int → double is possible → because there is no data loss
int i = do;

//double → int is not possible → due to missing data (0).5 disappears)
double d = in;

//NG even in the following cases (meaning that "possible data loss" type conversion is not implicitly allowed)
double dou = 10.0
int n = dou;

Checked exceptions must have a throws declaration

Caught point: It's not whether it's okay to throw

//Checked exceptions: Throws declaration is always required, including when explicitly throwing an exception, and the caller must also catch.
public void hoge() throws Exception{
 return new Exception()
}

//Unchecked Exception: No Throws Declaration Needed, No Need to Catch Anything
public void hoge() {
 return new RunTimeException()
}

The fifth argument of arraycopy is not what it looks like

Caught point: Probably the suspicion that I remembered it wrong

arraycopy(array1, x, array2, y, z)
//array1: Copy source array
//x: Where to start copying
// array2:Copy destination array
// y:Where to copy from the copy destination array
// z:"Copy source"Specify the number of characters to copy

Understand the relationships between primitive types for implicit type conversion

Catch point: Integer types cannot always perform implicit type conversion even between integer types.

Well, if you understand it properly, you'll understand ... For example, if it is an integer type, there are the following primitive types. byte,short,int,long These have different sizes, and the order of their sizes is as follows byte < short < int < long As mentioned above, implicit type conversion is only normal if ** "no data loss" **. Then, int → short with a value larger than the size of the short type may cause ** “data loss” **.

The relationship is described below.

Integer type

byte < short < int < long

Floating point type

float < double

char (convertible type)

char → int, long, float, double (probably because there is no character code that fits in the size of byte)

Not convertible

double, boolean

Recommended Posts

Aiming to acquire Java Oracle Silver, point memo (pass)
How to pass Oracle Java Silver
Java SE8 Silver ~ The Road to Pass ~
Summary of knowledge required to pass Java SE8 Silver
Java Silver Study Method Memo
Java Silver exam preparation memo
Java SE8 Silver Pass Experience
Time taken to acquire Java SE11 Silver, teaching materials used
How to study Java Silver SE 8
Inexperienced engineer struggle record: String type edition where I was studying aiming to pass Java Silver
Road to Java SE 11 Silver acquisition
Java Silver Repo (Failure & Pass Experience)
From Java to VB.NET-Writing Contrast Memo-
What you did to get the Oracle Certified Java Programmer, Silver SE 8
How a completely inexperienced person studied to acquire Java silver by himself
How to use submit method (Java Silver)
Oracle Certified Java Silver SE 8 Passing Experience
Java SE 8 Silver (Java SE 8 Programmer I) Pass Note
Inexperienced learning methods to get Java Silver 11
Memo for migration from java to kotlin
It took a month from application to taking the Oracle Java SE 11 Silver
Java memo
[Java] How to switch from open jdk to oracle jdk
How to use the replace () method (Java Silver)
[Java] Memo on how to write the source
A study method for inexperienced people to pass Java SE 8 Silver in one month