Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Norm Radder

Master Rancher
+ Follow
since Aug 10, 2005
Worked mostly with IBM mainframe assembly code.  Loved IBM's VM OS.
On vacation
Cows and Likes
Cows
Total received
32
In last 30 days
1
Total given
1
Likes
Total received
258
Received in last 30 days
9
Total given
48
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Norm Radder

Your keyboard has different characters than the compiler expects.
The first line is yours with the wrong characters.
The second line has the proper quote marks around the String.
14 hours ago

how to actually create two rectangles


Use a new statement to create instances of the class:
1 day ago

selection sort that string


I see several lines of code in the selectionSort method.  What determined what statements  were written there?  In other words what is the logic for that method?

I find it very useful when writing code to have designed the logic first, then write down the steps of the logic as comments in the code
and then write the code to follow the steps in the logic. 


The posted code does not compile without errors.
Please copy the full text of the error message and paste it here. It has important info about the error.
1 day ago
What is the logic for the selection sort?  Can you add it as comments in the code so anyone reading the code can see if the code is following the logic shown in the comments?
1 day ago
Do you have the list of steps a program must do to implement a selection sort? 
Could you add them to the code as comments so anyone reading the code can check to see if the code is following the steps shown in the comments.
1 day ago

can't get it to print right.


Can you post what the current output of the program is?
2 days ago
It looks like the search method is inside of the main method.  That is not allowed.  Methods can not be nested.  End the main method's code  by adding a } before the start of the definition of the search method.

The code could prompt for the user's input before calling the search method (instead of doing it inside of the search method) and then pass the values to the method.  That is what the method currently expects to be in its key and key2 parameters.
2 days ago
Do you know how to write a loop that will iterate one time for each slot in an array?  Hint it would use the array's .length field.
Do you know how to compare the contents of an array element to the contents of a variable (a primitive like int)? 
Hint use an if statement with array notation: theArray[index] and an == operator
2 days ago

it doesnt reorder.  

How do you know that?
Where does the code print out the changed contents of the array after doing the sort? The sort method returns an array but nothing is done with it.

BubbleSort: 


That is printed at the end of the sort method.  The main method needs to print the array's contents after that.
2 days ago

still doesnt bubblesort the words


What is wrong with the output you posted?  It looks like the words are in order.
2 days ago
Also can you copy the contents of the command prompt window from when you tried to execute the program and paste it here.


I assume the error message you posted was fromwhen you tried to execute the program.

Otherwise please explain where that error message came from.
2 days ago

I am just having trouble figuring out what i am doing wrong. 


Please explain why you think it is wrong.  Post any output that shows the problem and add some comments explaining what is wrong.

Do you have a description in English of the steps the code should take (a design) to solve the problem? 
Once you have that design, then write code to implement it.
2 days ago

  Is the compare () method in an Anonymous block?


The compare method on line 15 is part of the Comparator interface instance created on line 13
2 days ago

how to create components in a container


how to create components  -> use a new statement: ...  = new SomeComponent()
in a container -> use the container's add method:  container.add(someComponent)
3 days ago

Category Enum  but I do not understand where it's being used in his example.


See lines 41,42,43  and line 17
3 days ago