Blog: Andrew's Java Blog for Beginners archived |
240 blogs
updated: 0 min. ago
|
||
I created a series of images of the numbers 1 through 9 by typing them in a Word document in a suitable font. Then I copied them from there ...
|
||
A palindrome is a number which has the same value whether you read its digits forwards or backwards e.g. 8, 66, 525 etc. The program below s...
|
||
If you are starting to get to grips with Java and would like to use it to solve a mathematical problem, go to Project Euler I joined recentl...
|
||
If you have a constructor with parameters, you might want to use the same names for the variables in the class as you use for the parameters...
|
||
The example below shows a class with an overloaded constructor:Java > cat Rectangle.javaclass Rectangle { double width; ...
|
||
If you have a class called, for example, Rectangle, you can add a method to it with the same name as the class. This method must have no ret...
|
||
The return statement does not have to pass a value back at all. It can just be used to return control to the calling program. Once a return ...
|
||
This example is based on an earlier post but I have changed it to show how a method can return a value. The first part creates a class calle...
|
||
At this stage, I don’t know why you would want to do this, but Java allows method overloading. This means that you can have two or more meth...
|
||
I created a class called my_class with a method called times_two. The method accepts an integer and multiplies it by 2: Java > cat my_class....
|
||
Made better & faster using https://www.yourkit.com/ Java Profiler