OK. Anyway thanks for the help, honestly couldn't do the rest of the code without it! :)
Type: Posts; User: IneedHelpwithJava
OK. Anyway thanks for the help, honestly couldn't do the rest of the code without it! :)
Sorry I usually understand examples a lot better. Could you show me an example?
Nothing really actually I just changed my code to args[count].length instead of sentence[count].length. I don't know what I was thinking having arrays with no value.
This sounds REALLY useful! How...
Yes you're right. Both my arrays have no Strings in them which is why they don't produce any result. How would I make a new array which uses the strings from (String []args) without being called args?
Hmm ok. I'll have a think and get back to you. Maybe change some things in my code. Thanks for the help.
--- Update ---
Hey right now I fixed my problem of the exception out of bounds (which is...
Oh I forgot, my array is "the dog isn't first second" I can change it to anything but thats what it is at the moment. The max length is therefore the longest word, which is 6 characters. 4
The error...
oh right.
int anArray[] = new int[max]; //This is just a value i determined earlier that calculated the max length of the array
int sum = 1;
int count = 0;
int i = 0;
String sentence[] =...
int anArray[] = new int[max]; //This is just a value i determined earlier that calculated the max length of the array
int sum = 1;
int count = 0;
int i = 0;
String sentence[] = new...
Basically my java program is supposed to calculate the length of each string in anArray. That isn't too much of problem HOWEVER I can't seem to figure out how to collect strings of the same length...
Don't worry about it, it's a lost cause.
sorry for the lateness:
Essentially by ant moving I mean I want to shift a unique block to another index based on the symbol at that the index (ie. if it lands on a symbol * it means it should...
In my code there are multiple packages and methods but I will try to keep it as simple as possible.
The grid and ant look like this:
// prints ant and board
System.out.print("+");
for...
I see it often in for-loops and such, but I don't know what it really means. Help?
Thanks for the help, I can't believe it was that simple! :)
As my username suggests I need help with a lot of things. This grid I made is one of them. I get the following error message when I run the code below:
Exception in thread "main"...
Sure! Hold on...
package variables;
public class SimpleCalc {
public static void main(String[] args){
int n=11;
if (n<0){
if (n%2); ...
Thank you I will try this and come back
--- Update ---
That was helpful (i now understand the modulus operator) but I am getting problems in my code where it is not converting to boolean. See...
I was wondering how I could go about printing a number both negative and odd using "if" statements and (I'm assuming but not entirely sure) boolean?
I am really new to java and wanted to know how I can print an int which is both negative and odd and if so, needs to be put into the formula (n^2+1) . I am not looking particularly for answers...