I've decided to continue the blog here (now that I've received blogging permissions).
Type: Posts; User: OA-OD-JD1
I've decided to continue the blog here (now that I've received blogging permissions).
This blog has been continued over at Java Development Forums and in my JPF Blog.
Harvey's Java Blog
JD1's Personal Development Blog
Say we have an array with ten indices. Below is how we can calculate the sum of these indices.
class Class1{
public static void main(String args[]){
int[] array1 = {1,2,3,4,5,6,7,8,9,10};...
Thanks mate. I'll be sure to take a look some time.
Okay. In other languages, I've been used to doing it the way I orginally did, but since what you mentioned is standard Sun convention, I'll be sure to stick to that in the future.
Understood. Can you tell me why you put the square brackets after the data type instead of the array name?
And I'm glad you're providing these tips. This is the sort of thing I need. Also, with your example there, are you referring to an array initialiser with no indexes?
Arrays are used to store many values under the one variable, so to speak. You can initialise an array the long and drawn out way by manually assigning each index a value or you can implement an array...
Alright, I'll keep that in mind. Once again, I'd like to thank you for all your help today. I really appreciate it! :-*
Hi,
Some of that is still new to me. I still can't get my head around any of what you've written (since you're using alternative code). It's difficult for me to relate that back to my problem, let...
Random numbers can be used in Java. Here's a small random number generator and how it works.
import java.util.Random;
class Class1{
public static void main(String args[]){
Random dice = new...
There are many built in methods we can use to conduct mathematical operations to numbers. Here are some of them.
class Class1{
public static void main(String args[]){
//How far number is from...
We use the Do While Loop when we want to run a set of instructions before testing to see if a condition is true. The difference between a Do While Loop and a While Loop is that the While Loop tests...
If I go back to my last successfully working averaging calculator, Mr.777, I have two questions.
import java.util.Scanner;
class Class1{
public static void main(String args[]){
int numGrades...
Still not sure how to do that. I tried something just now but that didn't work either. I'm kind of more guessing where things go with this one. Can't quite get my head around the best way to do this.
Compound interest can be calculated with the following formula.
A = Amount
P = Principal
R = Rate
n = Years
A=P(1+R)^n
We can calculate the amount in Java as shown below. We currently...
The For Loop is probably the most common loop used in any programming language. Here's how it works in Java.
class Class1{
public static void main(String args[]){
for(int counter=1;...
That's what I'm trying to do. This is what I ended up with. No errors, but it won't let me input anything into the console.
/* The application will work as follows. The main method will be used to...
Okay, with relevance to my last post about the averaging calculator, I've written up the application exactly as I'd like it to look. The only problem is the variables, that's the last step. I've...
Not sure what any of that means, sorry. I'm still new to this and I'm not 100% on sending variables through methods and objects yet. Any chance you could provide an example?
I forgot to mention that. I actually haven't yet learned about the functionality of these comments, so I'll make sure to edit that post when I know what I'm talking about. Thanks for pointing that...
What this application does is collects a number of inputs from the user via a scanner. These inputs are numbers. They are then averaged and the average is outputted. Pretty simple stuff.
import...
So, basically, I'm limited to the amount of things I can do in the Conditional Statement? Whereas in an If Statement, you can really have as many instructions as you want. I suppose I can only output...
I forgot to write about the scanner, so I'm going to do that now.
Basically, a scanner is used to get information from the user. At this stage, the scanner will be used only to gather information...
I suppose you're right in saying that. The extent of my knowledge at the moment has the conditional operator acting like an If Statement in my head. Hopefully that will change when I start learning...