Java Definition and 572 Threads
-
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...- KillaKem
- Thread
- Java Numbers
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
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)...- andreass
- Thread
- Class Java Line
- Replies: 3
- Forum: Programming and Computer Science
-
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?- Funkmaster W
- Thread
- Java Language
- Replies: 6
- Forum: Programming and Computer Science
-
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...- RyMi
- Thread
- Computer Computer science Java Science Sort
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
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...- nkk2008
- Thread
- Java Value
- Replies: 2
- Forum: Programming and Computer Science
-
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...- nkk2008
- Thread
- apache Java Reading
- Replies: 1
- Forum: Programming and Computer Science
-
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...- nkk2008
- Thread
- Java
- Replies: 3
- Forum: Programming and Computer Science
-
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- nkk2008
- Thread
- Java String
- Replies: 7
- Forum: Programming and Computer Science
-
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...- noagname
- Thread
- Java Programs Resources Tips
- Replies: 3
- Forum: Programming and Computer Science
-
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...- nkk2008
- Thread
- Java
- Replies: 4
- Forum: Programming and Computer Science
-
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...- elbeasto
- Thread
- Java
- Replies: 6
- Forum: Programming and Computer Science
-
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...- makyol
- Thread
- C++ Java
- Replies: 1
- Forum: Programming and Computer Science
-
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...- the other guy
- Thread
- Code Java
- Replies: 7
- Forum: Programming and Computer Science
-
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...- notorious9000
- Thread
- If statement Java
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
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) {...- the other guy
- Thread
- Generator Java Random Random number
- Replies: 2
- Forum: Programming and Computer Science
-
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...- the other guy
- Thread
- Java
- Replies: 2
- Forum: Programming and Computer Science
-
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...- the other guy
- Thread
- Java
- Replies: 9
- Forum: Programming and Computer Science
-
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...- squelchy451
- Thread
- Java Program
- Replies: 6
- Forum: Programming and Computer Science
-
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...- hermy
- Thread
- Java
- Replies: 2
- Forum: Programming and Computer Science
-
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...- Quincy
- Thread
- Java Programming
- Replies: 4
- Forum: Engineering and Comp Sci Homework Help
-
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- Elixer
- Thread
- Book Electronics Java Suggestions
- Replies: 1
- Forum: Science and Math Textbooks
-
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...- n00neimp0rtnt
- Thread
- Confusion Cs Java List
- Replies: 4
- Forum: Engineering and Comp Sci Homework Help
-
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...- Lancelot59
- Thread
- Interface Java Programming
- Replies: 9
- Forum: Engineering and Comp Sci Homework Help
-
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) //...- Kat3rina
- Thread
- Class Java
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
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...- Redd
- Thread
- Columns Java Method Reading
- Replies: 9
- Forum: Programming and Computer Science
-
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...- tony873004
- Thread
- Java Windows
- Replies: 1
- Forum: Programming and Computer Science
-
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...- CyJackX
- Thread
- Accuracy bodies Java Simulation
- Replies: 7
- Forum: Advanced Physics Homework Help
-
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...- sean_vn
- Thread
- Java System
- Replies: 6
- Forum: Programming and Computer Science
-
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...- Helios
- Thread
- Code Java
- Replies: 7
- Forum: Programming and Computer Science
-
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...- Wm_Davies
- Thread
- German Java Language
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
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()))) {...- genu
- Thread
- Confusing Java Loop
- Replies: 4
- Forum: Programming and Computer Science
-
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...- iamsmooth
- Thread
- Algorithm Java List
- Replies: 6
- Forum: Programming and Computer Science
-
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...- tking88
- Thread
- Empty Java
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
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...- remaan
- Thread
- Java Program
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
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...- NiaSphinx
- Thread
- Addition Java
- Replies: 3
- Forum: Programming and Computer Science
-
Java Get Java Programming Resources | Help Available
If anyone can help me get resources for basic Java programming. Thanks- Maroc
- Thread
- Java Resources
- Replies: 2
- Forum: Programming and Computer Science
-
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...- Red_CCF
- Thread
- Java
- Replies: 2
- Forum: Programming and Computer Science
-
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...- jachyra
- Thread
- Circuit Java Simulations
- Replies: 1
- Forum: Programming and Computer Science
-
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...- Poisonous
- Thread
- Brain Java
- Replies: 10
- Forum: Engineering and Comp Sci Homework Help
-
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...- greenneub
- Thread
- Java Suggestion Text
- Replies: 1
- Forum: Programming and Computer Science
-
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?- mattbonner
- Thread
- Java
- Replies: 1
- Forum: Programming and Computer Science
-
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...- wolram
- Thread
- Java
- Replies: 16
- Forum: Programming and Computer Science
-
P
Java Java recursion longest common subsequence
can someone explain java recursion to me?- physicsfun
- Thread
- Java Recursion Subsequence
- Replies: 2
- Forum: Programming and Computer Science
-
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...- rathodnileshn
- Thread
- Java
- Replies: 4
- Forum: Programming and Computer Science
-
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]...- physicsfun
- Thread
- Arrays Java Rotating
- Replies: 1
- Forum: Programming and Computer Science
-
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...- physicsfun
- Thread
- Arrays Java Rotating
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
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...- royboyz12
- Thread
- Code Generator Java
- Replies: 2
- Forum: Programming and Computer Science
-
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...- irresistible
- Thread
- Arrays Java
- Replies: 1
- Forum: Programming and Computer Science
-
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...- cgrumiea
- Thread
- Java
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
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...- cgrumiea
- Thread
- Java
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help