Java Definition and 587 Threads

  1. P

    Java Java recursion longest common subsequence

    can someone explain java recursion to me?
  2. R

    Java Check Java Version on Multiple Installed JDKs

    Hi all, Suppose on computer 4 different versions of java are installed. (1) Depending on the path of java.exe we can open command prompt go to path /jdk_version/bin/java.exe and type "java -version" and know the particular version, But we can't extract the output of the command "java...
  3. P

    Java Why is My Java Code Not Rotating an Array 90 Degrees to the Left?

    I am supposed to write code to rotate an array 90 degrees to the left... so my question is, why is this code not rotating my array 90 degrees to the left? thanks for any help! public static int[][] rotateLeft(int[][] source) { int[][] result = new int[source.length][source[0].length]...
  4. P

    Comp Sci Rotate Arrays in Java: Troubleshooting 90 Degree Left Rotation Code

    Homework Statement Write code to rotate an array... Homework Equations why is this code not rotating my array 90 degrees to the left? thanks SO much in advance! The Attempt at a Solution public static int[][] rotateLeft(int[][] source) { int[][] result = new...
  5. R

    Java Java Insult Generator Code Issues?

    Hi, I have to do a homework assignment for my intro to computer porgramming class and i have to write a program that creates insult sentences. My professor gave us some code to start with and we had to fill in the functions(professor gave us the names of these functions and the name of the...
  6. I

    Java Need help setting up arrays for Galton box simulation?

    I'm new in java and I'm trying to come up with a program that stimulates the bean machine(also known as Galton box) Balls are dropped from the opening of the board. Everytime a ball hits, there is a 50% chance to fall to left and 50% chance to fall to the right. the piles of balls are...
  7. C

    Comp Sci Find the previous Fibonacci number: java

    Homework Statement The first several numbers in the "Fibonacci Sequence" are 0, 1, 1, 2, 3, 5, 8, 13, 21, ... Each number is formed by summing the two previous numbers. Define a method named prevFib that takes a non-zero Fibonacci number and returns the Fibonacci number that comes immediately...
  8. C

    Comp Sci Creating pow in Java: Learn Recursive Solution

    Homework Statement Define a recursive method named pow that takes two integers, x and n, and returns the result of raising x to the n-th power. Assume that n is non-negative. pow(5, 0) ==> 1 pow(2, 10) ==> 1024 pow(-3, 2) ==> 9 Homework Equations The Attempt at a Solution...
  9. J

    Schools Would Sun Java Certification significantly help my grad school prospects?

    I'm a physics student in the penultimate year of my degree. I'm quite good at programming and was thinking this summer I'd put in 3 months of effort and get Sun Java Certification. Would this be worth the effort? Would it be something which would be very attractive to a prospective grad...
  10. E

    Java Calculating Gravity in Java with 2 Bodies

    I'm pulling my hair out with this problem. I have two bodies and I'm trying to calculate gravity between them. This is for a game, and there are actually three bodies currently, each frame, I check the distance each one moves due to gravity and store it in a cache (to simulate gravity acting on...
  11. F

    Comp Sci Java Applet Help: Coding a Dots and Boxes Game Variant

    Homework Statement To code a dots and boxes game variant. Basically I need to code the same game except instead of drawing lines you choose two dots to form a line. I would need MouseListener for clicking and entering/exiting dots, a graphics update for changing colors of the dots and...
  12. K

    Comp Sci Which Language Handles Thread Operations Better for File Manipulation?

    Java or C++ - Threads HELP! I need help with this program. I got five others to do and I won't have time to do it and it's apart of my final exam for next Tuesday, can somebody write this program: Create 5 threads which share a file and let "even" threads write to a file, and let "odd" delete...
  13. K

    C/C++ Creating Threads in Java or C++: Balancing Writing and Deleting in Shared Files

    Java or C++ - Threads HELP! I need help with this program. I got five others to do and I won't have time to do it and it's apart of my final exam for next Tuesday, so here is my question I need: Create 5 threads which share a file and let "even" threads write to a file, and let "odd" delete...
  14. T

    Java Binary Tree java help please, with getRight and getLeft subtree.

    I can't figure out how to get these 2 methods to work. In my assignment description it says public BinTree getLTree() Get a reference to the left subtree. If this is not possible to do then throw an IllegalArgumentException. NOTE This routine returns a BinTree, not a Tnode. You...
  15. M

    Java Using Scanner in Java to await user hitting return key

    Hi all, I've been trying to figure out how I can use the Scanner class in Java to pause my program and wait for the user to hit the return key. What I have now looks like this: Scanner kbd = new Scanner(System.in); kbd.next(); ... The thing is, the rest of my program won't run unless there...
  16. K

    Java What Does java.lang.NumberFormatException: For input string: 'z' Mean in Java?

    i need to know what the error messege below means and how to fix it. Exception in thread "main" java.lang.NumberFormatException: For input string: "z" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:447) at...
  17. P

    Java How Can I Update My Java Language Filter?

    I have run into a problem... The language filter we have been using is out of date and it periodically does not work. I was hoping I could get some help on making a new one. The old one: import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.net.SocketAddress...
  18. T

    Why Can't I Use Time Dilation to Calculate Relative Time for the Ball?

    I am new to this topic. Please correct me if there is any mistakes. http://i359.photobucket.com/albums/oo31/tanzl/JavaPrinting-4.jpg
  19. G

    Java Can You Help Me Debug My Java LinkedList Stack Implementation?

    Hi, i need to use a list class (provided and complete) and then use a Linkedlist class (need to add the methods) to get a stack going. I am having trouble with my remove from head method although I ain't too sure if my addHead method is right... I'd appreciate it if someone could look over my...
  20. T

    Java Java Keyboard Reader: V1.3 to Newest Version

    I have recently started to try to teach myself java and i can't get the keybord reader to work. I'm a book thet's for java V1.3 but I'm using the newest version is that the problem? unless the book was wong then my program syntax should be fine. could anyone tell me what the syntax for the...
  21. N

    Java Java 2 The Complete Reference - Herbert Schildt

    Has anyone here used this book? If you have, how would you rate it. To my surprise many programmers seem to despise Schildt's books. One is usually directed to this page to make the point. I was surprised because I found his beginner's guide on C++ quite easy to read and understand. (And...
  22. S

    Java Why Won't My Java Blackjack Game Compile?

    Making a blackjack game with Java, but it won't compile :cry:. Can't figure out why. Code import java.util.*; class Blackjack { public static void main(String[] args) { Scanner in = new Scanner(System.in); Deck myDeck = new Deck(); Player me = new Player(1000)...
  23. J

    Java Is it possible to decompile .exe files to Java using Jbuilder2007?

    I have Jbuilder2007 and I am wondering if there is a way i can decompile .exe files so i can read the code in java.
  24. A

    Java Improve Your JAVA Sudoku Game with Helpful Tips - Urgent Project Assistance

    Hi guys, I'm being asked to do a mini-project...Basically, i get a code in JAVA and "edit". Editting can be improving the interface, adding exception handling or adding features and so...I chose Sudodu as my topic..after much searching I found this code but I'm out of ideas, what can be improved...
  25. L

    Java Java: Check LinkedList<T> Classes

    Could someone check the following 3 classes for me please? public class LinkedList<T> { public Node<T> first; public Node<T> last; protected class Node<T> { public Node<T> next; public Node<T> last; } public class Iterator<T> { protected...
  26. L

    Comp Sci Creating a DoublyLinkedList Iterator in Java: Tips and Tricks

    Hi I'm struggling to create a DoublyLinkedList<T> class in Java. Well,it's actually the iterator that's freaking me out.. Most tutorials and documents I've read use three classes for this:Node<T>,DoublyLinkedList<T> and LinkedListIterator<T>. I can see the point in creating Node and...
  27. G

    Java Fix Java Compile Error: "The system cannot find the path specified.

    My problem is the first one listed here http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html But when I type C:\jdk6\bin\javac HelloWorldApp.java I get the message "The system cannot find the path specified." Both the compiler and HelloWorldApp.java file are in C:/ folder...
  28. C

    Comp Sci Java question - problem adding and deleting items from JComboBox

    here is my code import javax.swing.*; import java.text.*; import java.awt.event.*; public class Ch6Bagel extends JFrame implements ActionListener, ItemListener { //create GUI objects JPanel mainPanel = new JPanel(); JTextField bagelQuantityTextField = new JTextField(10)...
  29. M

    Comp Sci Advice to game project with Java

    For object-oriented programming course this semester, I have the last-assignment. The assignment requests the student to build an adventure game. The game, of course, have to apply GUI components. We are allowed (and encouraged) to continue last-year course-participants project. I have decided...
  30. C

    Comp Sci Why Does My Java Bagel Shop Application Show All Costs as $0.00?

    I'm creating an application that allows the user to choose one variety of bagel and the quantity of bagels he wishes to purchase. The user can choose if he wishes to buy cream cheese and choose the variety he wishes to add to his purchase. My calculation isn't working correctly. Here is...
  31. C

    Comp Sci Java calculations w/ conditional statements

    I'm supposed to calculate the cost of renting a Ford, Cadillac or Toyota, and use conditional statements to calculate the different costs of each vehicle. users are supposed to enter “F” for Ford, “T” for Toyota, or “C” for Cadillac users enter “F” for Ford, “T” for Toyota, or “C” for Cadillac...
  32. C

    Comp Sci Need Help Solving Java "Method Must Return a Result of Type Int" Error

    This is really making me mad. I keep getting a "this method must return a result of type int" error message, but obviously I have a return statement trying to return an int. This is a program that is supposed to perform a sequential search for a string index. public static int...
  33. C

    Comp Sci Java project output problem. Can't output objects from a method.

    I'm trying to create a bookstore calculation program with two classes, a presentation and computation class. Here is my code for the presentation class: import javax.swing.*; import java.awt.event.*; import java.text.*; import java.awt.*; public class ch4Book extends JFrame implements...
  34. A

    Java Solve Simple Java Annagrams Problem

    [SOLVED] Simple Java Problem Hello, In my computer science class, we were assigned to design an annagrams class, which would create a HashMap of String => HashSet, a sorted sequence of letters mapped to all annagrams of those letters found in the dictionary. This was done. Sample entries...
  35. C

    Comp Sci Solve Java JLabel Problem: Display Output on mainPanel

    i am trying to display the output in a jlabel. I have created individual jlabels for the package ID, weight, and shipping cost and tried to display them with the mainPanel: import javax.swing.*; import java.awt.event.*; public class shippingCharge extends JFrame implements ActionListener {...
  36. E

    Java Help with Java Classes for Blog App Project

    Hello! I have a project in which I must simulate a blog application,with users' post mangament. These are the requirements: A blog has a title and a collection of posts.The posts have the following information: -author -data -title -text Each post has a code that is generated...
  37. C

    Comp Sci Java Project Calculator for Shipping Costs

    i'm supposed to create a GUI project that will display a package ID and calculate its shipping cost. the shipping cost is calculated per ounce, and i must convert the pounds to ounces for the shipping cost. everything seems to be working fine except for the calculation. the shipping cost is...
  38. W

    Comp Sci How can I fix my Java program to give accurate change?

    I had to write a java program that will give you the change for whatever random number that program picks. I keep having a problem with the pennies. If have to have more than one penny then program will repeat the output until it gets the pennines right. PLEASE HELP! I am not really good at...
  39. N

    C/C++ Download Java & C++ eBooks for Home Learning

    hii i need a link that i can downlaod from it books (dammes series) about java & c++ because i am learn it in home
  40. Math Jeans

    Java Solving Java File Not Found Error - "Sgrep.java

    Hello. I am having some trouble getting a java program to work. I am supposed to make a program that takes a word and a file name, and finds all lines in that file that contain that word. The word that I chose was "try", and the file was "Sgrep.java" Here is the main method: class main...
  41. L

    Comp Sci How do I construct nodes with values in a generic Java LinkedList?

    [SOLVED] Java LinkedListNode class Hi.. I'm trying to understand a generic linked list...in Java. I understand that I should have a LinkedList class containing a Node class. The Node class should have an info variable and a link variable.These variables should be accesessed through the...
  42. C

    Comp Sci How to Structure a UML Diagram for a Basic Java Program?

    So I have to create a UML diagram for my program: import java.util.*; import java.text.*; public class NameDate { public static void main(String[] args) { // Input the first, middle, and last name // Display the name and the date. String firstNameString, middleNameString...
  43. C

    Comp Sci How do I fix a java.lang.NoClassDefFoundError in my Java program?

    Supposed to make a program that displays an entered name and date, etc, but it won't run. import java.util.*; import java.text.*; import javax.swing.*; public class ch2NameAndDate { public static void main(String[] args) { // Input the first, middle, and last name //...
  44. T

    Java How to create an executable java application?

    Hi, I've recently written a small program to calculate multiplicative group tables for Z mod n. I wrote it in java, as that's the only programming language I currently know. import java.util.*; public class ZnX { public static int gcd(int a, int b) {...
  45. U

    Java Can java applet be as big as the browser window

    Here's a java applet that shows the electric field of a moving charge (it's actually incorrect, it only gives a rough idea how motion and acceleration affect electric field). http://www.cco.caltech.edu/~phys1/java/phys1/MovingCharge/MovingCharge.html Can a java applet like this be the same...
  46. S

    Java Simple Java Email Harvester Program

    Hey guys, I am learning Java and am attempting a project from a book, but I have run into a problem. I don't have an issue when it comes to harvesting an address that has whitespace on both sides. My issues come when a) the input doesn't contain whitespace on either side of an address and b) the...
  47. U

    Java AJAX vs JAVA: A Comparison of Web Development Languages

    Which one is better? It turns out that AJAX suffers from the fact that 90% of development time is spent trying to work around intricacies of specific platforms, which is why google came up with a library that converts JAVA applets into AJAX code. But why not stick with JAVA anyway? Can't JAVA...
  48. U

    Java Suggest me some good books for java

    hi frnd ... suggest me some good books for java ... im a beginner .... i read "java complete reference " .... i want some new advanced books
  49. O

    Java How to Count Rows and Columns in a Two-Dimensional Array in Java?

    I just have a question about my "solution" to a problem. The question says to write a value returning method that returns the number of rows in a two-dimensional array of doubles. It should be simple enough and so I did it like this: public int countRows() { int x; x = 0; for (int...
  50. V

    Java Question about this java program

    OK here is my source code for a small Java program I wrote to approximate the number e: import java.util.Scanner; public class E { public static void main (String[] args) { double e = 0.00, current_e = 0.00; int x, number_of_digits; Scanner scan = new Scanner (System.in)...
Back
Top