Matthew Han

Greenhorn
+ Follow
since Jun 09, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matthew Han

Ok, so all of them will run at the very beginning of the program? in the book it says this static stuff runs after superclass and before instance

Henry Wong wrote:

Matthew Han wrote:shouldn't the static initializer run first to set Length to 10 and then, line 3 set it to 5?



No. Initialization of static variables, and static initializers, run in the order that they appear in source.

Henry

7 years ago
I have a question about this review question, the answer is swing swing 10, shouldn't the static initializer run first to set Length to 10 and then, line 3 set it to 5?

Thanks
7 years ago

I just did a little funny code changing this morning, (a little curious), but I found the printout is this: +138915-08-06.
What does the plus sign mean here? Why it is not there when the year is smaller?

Thank you.
7 years ago
Hi Norm,
Sorry, I meant even there is an exception, the code still can compile, but at runtime, the exception will be thrown, right? I was wondering if the code could still compile.

Thanks again


at runtime, there will be an exception.


No. It is not necessary that there be an exception.
7 years ago
Thanks for the great answers, so that means, an exception must be at runtime after compiling the code? This means the code will be or should be compile fine but at runtime, there will be an exception.

Norm Radder wrote:Does not compile would describe a source file where the compiler finds syntax errors
runtime error is would be an error that happens when the compiled code is running
An exception is a type of runtime error

7 years ago
Hi Liutauras,
Thank you, I don't really have an example, but just confusion on those terms.



Matthew

Liutauras Vilda wrote:Matthew, welcome to the Ranch

Could anybody help me with these concepts? I am a little confused with them.


Do you have and could provide some particular examples which confuse you?

7 years ago
Thanks, Les, I am still learning,
Thank you very much

Matthew

Les Morgan wrote:Matthew,

Here is a link to The Java Really Big Index, it is a list of topics and links for Java documentation and also a list of tutorials for further reading.

Or here is a link specifically to the Oracle Tutorial on Exceptions.

Basically any method that can throw an Exception has to have that Exception caught or passed up to the caller of the present method so:

or to handle an Exception locally you need to have a try/catch block like this:

Les

Matthew Han wrote:Could anybody help me with these concepts? I am a little confused with them.

Thanks

7 years ago
Could anybody help me with these concepts? I am a little confused with them.

Thanks
7 years ago
Hi guys,
I have a question about one of the review questions in Chapter 2
question 9: how many times will the following code print "Hello World"


the answer is this is a infinite loop, but I thought it was going to print out Hello World 10 times. I have a hard time to understand the answer explanation.

My idea is that i is 0 at the beginning, then turn to 1, print Hello World first time, go back to for(), check i still less than 10, then, i turns to 2, print Hello World again.

Thank you all,
7 years ago