Java Definition and 572 Threads

  1. K

    Comp Sci How do you add odd numbers up in Java?

    I want to add all odd numbers in a number n(ie if n=123456, then i am lookin' for 1+3+5=8) I have written a small program and it won't work i don't know why!How do i solve my prob? public class Odd { public static void main(String[] args) { int n = 3; // just set n to any number...
  2. A

    Java JAVA - how to use command line arguments in more than 1 class

    Hello. I have this JAVA code, I have to change only class "LS", so that program gets sum and displays it. But I don't know how to get command line arguments to LS class (I need them in "??", to get sum). Can anyone help? :) public class S { public static void main(String[] args)...
  3. F

    Java Sites to help teach/reinforce the java language

    I am currently taking a computer science II class in high school, in which we use java, and my teacher does not really know how to go about teaching and when she tries to help usually makes things worse. Does anyone know of any sites to help teach/reinforce the java language?
  4. R

    Comp Sci Computer Science - LSD Radix Sort in Java

    Title kind of explains what I'm trying to do here. I know exactly how radix sort is SUPPOSED to work but I just don't have a clue how to go about coding it. Basically what I am asking for is some java based pseudo-code just to get me in the right direction. I'm specifically sorting an...
  5. N

    Java How do I check if there is nothing filling in the index at i of the array?

    I have an array of doubles that is too large (i.e. it is of length 10, but only indices 0 to 6 are filled). I want to trim it, and am having problems with the line for loop{ if(array[i] == null{//THIS LINE action } } It says that "the argument type == is undefined for types double...
  6. N

    Java Reading .xls in java using Apache POI

    I have been given the task to write a program that does some basic math and numerical integration on numbers. Those numbers are stored in a .xls file. I have looked online and have seen the Apache POI and whatnot, but I have some serious problems stemming from my total lack of knowledge: How...
  7. N

    Java How Can I Set Character Encoding in Java When Writing to a CSV File?

    Ok, so I have been asking a lot of java related questions this past week or so. Now, I have yet another one. My program takes a bunch of input in the form of arrays of doubles, and prints it out to a comma separated csv file for use in a spreadsheet. However, when I try to open the file, I...
  8. N

    Java Extracting a number out of a string in Java

    I have a string of the form "int,int,int,int" and I want to extract each of those ints into a variable that is an int. I have no idea where to even start (I am learning Java as I make a program for an internship, and my searching has yielded nothing). Thanks, Nkk
  9. N

    Java Improving Your Java Programs - Tips & Resources

    In school I'm in a class AP Computer Science where we learn java. In the past few weeks I have learned the basics of java which came very easy to me. Now I want to know what can I do to my programs to make them stand out? What should I strive for, least amount of lines or looks the best(we...
  10. N

    Java Compiling Java Program for Use Outside of Eclipse GUI - Nkk

    I have a java program in Eclipse, and was wondering how to make it such that i can take a file or two onto another computer and run the program without the Eclipse GUI (i.e. as you would run/install a normal program). I am hopelessly lost from googling, as I understand nothing. What is the...
  11. E

    Java How to Import Classes in Java NetBeans

    I have a rather large list of classes that are have created and rather than compiling the classes that are needed with the main code I would rather use import. The problem is I do not know how to make that reference. My end goal is to have a package called someClass and a file named...
  12. M

    C/C++ Should I Learn C++ After Knowing Java?

    Hey there, For an Electrical Engineering candidate, will you suggest to learn C++. I am currently know Java and i am thinking about learning C++ by taking an elective course in my university. What do you think? Is it worth to take that course also can C++ help me in my career as an electrical...
  13. T

    Java Can someone look at this Java code for me?

    im starting a project from an Ebook that seems to be missing a line or two or something. Can someone suggest what should be here? I added the ending parsing since it was one of the more obvious missing things. import com.sun.j3d.loaders.*; import...
  14. N

    Comp Sci Java help (how to not to use if statement)

    Java help ! (how to not to use if statement) My teacher asked the user for an integer and converted it into a number in base N, where N was a value between 2 and 9, inclusive. Expand this program to allow values of N between 2 and 36, inclusive, where digits representing the numbers 10, 11...
  15. T

    Java Java random number generator help.

    Hi, I'm trying to get it so that when the program initiates, if the random number is greater than 3, I turn left. here is what I have in summary; int rt=3; Random ra = new Random(); for (int c = 6; c <12; ++c); { } if(rt<ra) {...
  16. T

    Java Why Does super() Cause Issues in Java Inheritance?

    So, I'm new with the JAVA, and I am trying to import the properties of one file, into another. it looks like this- the executible file will connect to a subclass file (called subclass1), but subclass1 is a subclass to another class file (parentclass) the parent class will give details...
  17. T

    Java Fixing Abstract Method Error in Java Shooter Game

    I've been doing homework all day. I can't seem to figure out how to fix this. I dunno...maybe I'm depressed. So, in my attempt to build a simple shooter (kinda like pong, only you shoot at each other), It seems all my problems root from this error; Shooter.java:9: Shooter is not abstract and...
  18. S

    Java What is causing NaN values in Java program?

    Hi I wanted to make a program that would check if a number if it was an integer or not in Java. here's the source code: import static java.lang.Math.*; public class gcd { public static void main(String [] args) { double a = 1; double b =1; double c = 1...
  19. H

    Java Java DK is not getting installed

    Hello! I installed java developers' kit today, but in c:\program files by mistake. I wanted to change it to c:\, so initially I just cut-pasted it. It didn't work, so I uninstalled it (add or remove programs in control panel). However, when I tried to delete the "java" folder in c:\, it said...
  20. Q

    Comp Sci Fixing HashMap Values Issue in Java Programming

    import java.util.*; import java.io.*; public class Friend { private static int id; private static double lat; private static double lon; public Friend(int id, double lat, double lon) { this.id = id; this.lat = lat; this.lon = lon; } . . . . public void...
  21. E

    Book suggestions for Java and Electronics

    Can you please suggest some good books a learning Java and electronics? I have learned C++ and I plan to learn Java now. I also want to begin learning electronics by myself. Thank you Elixer
  22. N

    Comp Sci CS: linked list confusion (Java)

    I just took my final for Data Structures and there was a question on it dealing with linked lists. A part of the question really threw me off. It looked something like this: public class Node { int contents; Node next; } public class LinkedList { Node head, tail...
  23. L

    Comp Sci Programming an interface in Java

    For my final project I need to code a program to handle a bookstore. Because the Java console isn't meant for stuff like this I decided to make my own UI. The inventory, reports, and cashier section each get their own tab. Each tab has a console output screen, a box showing what you just...
  24. K

    Comp Sci Java NullPointerException in class using HashMap

    1.Homework Statement + Homework Equations Hello, I really need your help, because I'm a Java newbie and I've got stuck in this Java homework. I should implement class ObjectCounter, which has to include two methods: // increase the counter for given object public void add(Object o) //...
  25. R

    Java A Java method for reading rows and columns?

    I have an assignment where we have to use loops to print quarter diamond patterns. I don't really need help with the actual coding, since the prof basically gave us a pseudo-code as a hint, but in the pseudo-code there is a variable for the number of rows and columns. I have been searching...
  26. tony873004

    Java Help installing Java on Windows XP

    I'm taking a class on Java programming. I'd like to install Java on my home PC. According to our class' website I am supposed to But there is no download link on this page. There is a message on that page that says I don't want to learn more. I just simply want to install Java. If this...
  27. C

    Improving the accuracy of a Java simulation of n-orbital bodies

    Homework Statement So, I'm creating a 2d graphical simulation of orbiting bodies. Right now I'm just working with 2 bodies, one stationary, but I would hope to extend this program to be able to include any number of moving bodies and have them interact accordingly. After combing...
  28. S

    Java How do I bind a UDP socket to a port and read from a server in Java?

    I have just created a Java native wrapper for my fast Walsh Hadamard transform and O'Connor Transform code. I am getting 2000 65536-point WHT's per second and 540 65536-point OCT's per second. That is about as fast as you will get without resorting to Nvidia CUDA or whatever. The code is...
  29. Helios

    Java Get Help with Java Script Code: Calculate Day Count Since 1922 Dec. 18

    Dear Computer People, I know nothing about Java. What I understand what "Java script" means is something that one can paste into an html document or web page. What I have is a Java script code that displays a day count since 1922 December 18. Here it is. <script> var montharray=new...
  30. W

    Comp Sci Using the German Laguage or ANY Foreign Language with Java

    Homework Statement First of all this isn't for homework. I am trying to create a Java program that will test me on the German language for my German class; however, I do not know how to get the umlauts, accents, and other special characters to show up. Do I need to import a language handler...
  31. G

    Java Java While Loop for Searching Last Names: Solving Confusion in ExtPerson Class

    public boolean search (String lastNameSearch) { LinkedListNode<T> current; current = first; boolean found = false; ExtPerson person = (ExtPerson) first.info; while (current.link != null) { if ((person.lastName.toLowerCase().equals(lastNameSearch.toLowerCase()))) {...
  32. I

    Java What's wrong with my sorted linked list algorithm? (Java)

    So my algorithm compares a node that needs to be inserted with the current linked list set. it goes from first (which contains the lowest integer) and moves forward until it hits null or when the key trying to be inserted is no longer greater than the nodes being compared to. My input of 23...
  33. T

    Comp Sci What is Instance, Empty Constructor in Java

    What is Instance, Empty Constructor ... in Java How come will return false I put in 2 same name it should return true ? Teacher p1= new Teacher("Nelson"); System.out.println(p1); Teacher p2= new Teacher("Nelson"); System.out.println(p2); System.out.println(p1.equals(p2)); it...
  34. R

    Comp Sci Java Program Helpers Come in Please

    Java Program Helpers Come in Please ! Homework Statement I am writting a program which asks the user to enter his email adress, and then prints - according to five conditions - if his address is valid or not . 1. there should be exactly one @ in the address he enters. 2. there should...
  35. N

    Java Java int addition - the long way

    Hi guys, I'm trying to figure out a way to split up integers so I can do addition the old school way in Java. E.g.: 1234 1234 +_____ 2468 So you know start at the 4's and then add them up and move left etc. Does anyone have any ideas on how I access the different digits of...
  36. Maroc

    Java Get Java Programming Resources | Help Available

    If anyone can help me get resources for basic Java programming. Thanks
  37. R

    C/C++ Transitioning from Java to C/C++: Navigating the Challenges

    Hi I'm selecting courses for University right now. I have two options for my computer programming course. I can selected either two programming classes (one fall, one winter) that is designed for beginners with no prior programming experience or I can selected just one class (which is an...
  38. J

    Java Circuit Java Simulations - Amazing

    Hi all! This may have been previously posted before but check it out! Just discovered this today. It's really cool. Great for getting an intuitive feel for what is happening in circuits. Try hovering over the components to get simulation info of each component...
  39. P

    Comp Sci Math Brain Teaser Question and attempted solution with Java - .

    Homework Statement The question is thus: e = even digit o = odd digit eo x ee ----- eoe +eoe ----- oooe Which is just the expanded multiplication of the numbers eo and ee, with eoe and eoe being the partial products and oooe being the product. The question is to find...
  40. G

    Java Need suggestion on good Java text

    Hey guys, so the second half of my first year comp sci course is winding down, and the exam is fast approaching. The problem is that our "text" for Comp Sci 102 (second half of first year comp sci) is a collection of notes by one of the professors in the department. After comparing his section...
  41. M

    Java Learn C from Java - Free Resources

    Does anyone know of any resources (preferrably free) to learn C for someone who has learned Java before?
  42. wolram

    Java Trying to reinstall Java after a problem

    Can some one help please, i am trying to reinstall Java after a problem, i have removed all the old program from add/remove center and used system mechanic to check registry etc, but when i try to download java it gives me error 25099, i have tried the off line version but that is the same, i...
  43. P

    Java Java recursion longest common subsequence

    can someone explain java recursion to me?
  44. 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...
  45. 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]...
  46. 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...
  47. 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...
  48. 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...
  49. 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...
  50. 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...
Back
Top