Java Definition and 587 Threads

  1. A

    Comp Sci BigInt Inc Method - Adding 1 to Last Element?

    Thers a class called BigInt and it has a size and digit. size is the number of digits in the integer that is entered and digit is an array that holds the integer. theres a method which is supposed to just add one to the BigInt so i figured that i could just add one to the last element of the...
  2. K

    Comp Sci Why Use Generics in Java ArrayLists and Modify Default Capacity?

    I am learning about the ArrayList class in my java programming II class. I am wondering why you would specify an arrayList to only contain, for example, strings: ArrayList <String> arrayName = new ArrayList <String> (); versus ArrayList arrayName = new ArrayList (); in which, to my...
  3. A

    Comp Sci Java BigInt Class: Adding Two Objects with Carryover | Plus Method

    Thers a class called BigInt and it has a size and digit. size is the number of digits in the integer that is entered and digit is an array that holds the integer. Theres a method in the class called plus which is supposed to add two BigInts together. If there is a remainder the remainder is...
  4. D

    Java Java and proxy authentication on xp

    I would like to use Jabref to connect to internet from a windows xp computer. However, I have to access interent through a proxy which requires authentication. Although I can pass the ip address and port to java, I didn't find a way to authenticate. Any ideas? Thank's DrDu
  5. C

    Java Oceanic plateau like Java Ontang

    Were there oceanic plateau formation for before plate tectonics era? Perhaps later, plateau gave rise to terrenes along west coast of N. America. Might Mars serve as a model of what pre-tectonic era looked like on Earth? Are there plateau on Mars? If not, then this would seem consistent with...
  6. A

    Comp Sci How can I fix an error in the insertion sort while loop in a Java program?

    So i haven't done java in about two years, its been a while since I've seen arrays. THe assignment is to fix a program that was given to me. I found one error but in the insertion sort part i can't get it to run the while loop. I can't make any fundamental changes to the program, basically i...
  7. M

    Comp Sci What does the error T does not match T mean in my Java code?

    I am getting compilation errors in the following segment of my code: _underlyingStorage was declared in the following way: private T[] _underlyingStorage = (T[]) new Object[128]; public T next() { _currentIndex++; if(_underlyingStorage[_currentIndex] ==...
  8. M

    Comp Sci Java NullPointerException: How Can I Fix a Null Pointer Exception in My Code?

    For the following segment of code, I am getting a null pointer exception when trying to access any value in a list (doubly-linked with dummy nodes) AFTER a null value. For example, if I have the following list of integers: 0, 1, 2, 3, null, 4, 5 and I run the function list.contains(0) or...
  9. M

    Comp Sci Java finding a specific element

    i am using dummy nodes for a doubly linked list and trying to get an object at the specified index. for whatever reason, when i test it, i am getting data but it is backwards. for example, when i have a list of integers from 0 to 21, and i attempt to call get(2), i get 19 which is at index 2...
  10. M

    Comp Sci Java Removing Element from List

    i am trying to remove an element from the back of the list (i.e. the node right before the tail). i am using a dummy head and tail node. the code compiles correctly, but when i try to test it, there is no execution. below is the segment of code that i am referring to: public Object...
  11. M

    Comp Sci Java NoSuchElementException error

    I am writing code for a doubly linked list, but when I try to compile it, I am getting an error when trying to throw the NoSuchElementException() function. Here is the part of the code concerning the issue: // _size is an integer that keeps track of the number of elements. in this case, i am...
  12. E

    Java Gravitational Constant Problem in Planetary Java Model.

    Hi there I am currently trying to implement Newtons law of gravitation into a planetary model. I have 2 objects with mass of 500 and 20. The distance between them is 150. From what I gather from wikipedia I could use the following formula: GravityField = G * ((500*20)/(150^2)) Where G...
  13. A

    Java Is java the best language for 2d games?

    Dunno if anyone have played a massive successful game called "Altitude", it's a multiplayer game, I have no idea what language it is coded, but I want to know is it possible to code a cheap mock up of the game with Java? And distribute it on Android?
  14. T

    Comp Sci How Does Java Treat Strings Like Primitive Data Types?

    "String" in java.. Homework Statement its a bit conceptual question. there is a string class which we use to store strings of letters. 1) but we don't create a reference to it,nor we instantiate it. 2) not even a method is invoked mean in printing, we just mention name of string class. 3)...
  15. T

    Comp Sci Casting in java && wrapper class

    casting in java...&& wrapper class Homework Statement well my question is quite simple. 1..) when a vector is instantiated ,does it needs to have a particular data type like integer,employee... like in case of array or does any object can be put into it irrespective of its name... example...
  16. U

    Java Why Are My Images Not Loading in Java Swing?

    The error: "Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:167) at Buttons.<init>(Windows.java:12) at Buttons.main(Windows.java:38) Java Result: 1" The Windows.java code: _______________________________________ import...
  17. S

    Comp Sci Creating Animations with Java: Tips for Novice Programmers

    I am a novice programmer and I need to create an Animation using Java. Basically, this animation needs to consist of moving ellipses on a graph. Does anyone have suggestions as to the easiest way to go about doing this? I've been looking into using java.awt and javax.swing to draw the graphics...
  18. F

    Comp Sci The Longest Increasing Sequence in a Two-Dimensional Grid of Numbers

    Homework Statement "Write a recursive Java program that finds the longest increasing sequence in a two-dimensional grid of numbers. A sequence is simply a series of adjacent squares. Squares may not be used twice. A grid might have multiple longest sequences. If an input grid does have...
  19. M

    Java Moving Onward from Introductory Java

    After learning the basics of Java, what should I be learning about to help me prepare for the rest of a Comp Sci degree? I am running Mac OS X, so I was thinking of learning my way around the terminal/bash, or something else Unix-based. My ultimate goal is software engineering, so I know...
  20. pairofstrings

    Java Core Java & J2EE & Advance Java

    What is the difference between them? Which of them is used in building websites and which of them is used in designing application for mobile phones and other systems?
  21. U

    Java Troubleshooting Java Arguments: How to Fix Common Errors

    I'm suppose to type this in and get a certain error and I did: http://i56.tinypic.com/2qdyebn.jpg So the writer says I need to type in three arguments, and his sense of humor brings me to do this: http://i51.tinypic.com/2i1z138.jpg I click OK Then when I click Run again I again get...
  22. pairofstrings

    C/C++ Comparing Java and C/C++ for Data Structures

    Which is better Java or C/C++ with data structures and why?
  23. U

    Java How Do I Set Up Java on Windows 7 If the Instructions Are for XP or Vista?

    I bought a book for beginners and it said "On Windows Vista or Window XP, navigate through Start, Control Panel, System, Advanced (System Settings), Environment Variables. Select the System Variable named "Path" and then click the Edit button. Add the address of Java;'s bin sub directory at the...
  24. B

    Comp Sci Count Files with Java Program: Easy & Fast

    I am attempting to write a program to do the work for me. I started in the process by hand and it took about an hour to get through the letter a. So I have a folder with many sub-folders and each sub-folder has at least one sub-sub-folder and then in theses many sub-sub-folders are the...
  25. M

    Java Comparing Java & C Programming: Questions & Answers

    So I have multiple questions regarding these two programming languages. 1. Which is better to learn first? 2. I recently emailed a possible future university asking what languages they teach. In the email he said "Java rafter than C" Now does that mean mostly Java but C included? Or no C at...
  26. T

    Comp Sci Java se program for color having trouble

    1.Write a Java program that does the following: a. Creates a Ball class with attributes for color, hardness, and size and instantiates the following Ball objects: golf, baseball, soccer. b. Creates a display method which can print the current state of the attributes for all objects. c...
  27. iamjon.smith

    Comp Sci Advanced Java: Client/Server Application Problem

    Assignment: Write a client and server, Java Swing application using socket connections that allows the client to specify a filename to the server in a Textfield and the server send the contents of the text file back to the client if it exists. If the file does not exist, then it should send...
  28. Y

    Java Display Image in Java: Sample Code & Explanation

    I know this is probably a simple question but I want to make a program that uses an animation but don't know how to display an image like a jpeg in a program. I found a couple answers to this online but don't really know what's going on in the code. Would someone mind writing some sample code...
  29. H

    Comp Sci How to Test if a Matrix is a Magic Square in Java?

    Homework Statement Magic squares. An n × n matrix that is filled with the numbers 1, 2, 3, ..., n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value. Write a program that reads in n2 values from the keyboard and tests...
  30. H

    Comp Sci Troubleshooting Array Lists in Java

    Homework Statement Input a list of n integer values into a 1-D array and do the following: • determine and output the number of positive values and the number of negative values • update the array values as follow • if the value is located at an even-numbered subscript, replace the value by...
  31. E

    Java Why Does PrintWriter Stop Writing Early in Java?

    I'm writing a script that changes the format of a datafile into a more suitable format for us to import it in Origin. The problem is that it only writes until line 2179, but it is supposed to write until it reaches 4096, where the datafile also ends. public static void main(String[] args) {...
  32. iamjon.smith

    Comp Sci Java Comparable Interface due tonight

    Create a class Product that stores product ID, product name, and price. Using the Comparable interface, create a compareTo() method for your Product class that gives you a default sort order based on product ID. Create a test application that creates a list of Products, sorts them by product...
  33. B

    Java Java: Accessing Private Variables in Client Class

    Hello there; I have a very short question about client class access: Suppose in a supplier class an instance variable is declared private (and is used in the constructor), and a void method in the same class (declared public) changes this variable. In the client class, is calling this method...
  34. iamjon.smith

    Comp Sci Develop Java App for Reading Inventory File: Total Inventory for Each Product ID

    Develop an application that reads a file of inventory information containing product ID and quantity. An example inventory file: 10401 32 10522 25 10401 1 10402 15 The file can contain several entries for the same Product ID. Your application should accumulate the quantities for...
  35. B

    Comp Sci How Can I Ensure Messages in Java ArrayList Are Sorted by Time Descending Order?

    Java problem ArrayList problem, **URGENT** hard question Introduction: You are part of a team working on a software system for a mobile phone company. The team is working on the development of the component that will be used for storing text messages. The initial design has a structure using...
  36. iamjon.smith

    Comp Sci How Can TreeSet Be Used to Manage Unique and Sorted State Entries in Java?

    You have been tasked to develop an application that reads customer information from a file to determine in which states you have customers. The file contains records with customer first name, customer last name, street address, city, and state. The file could contain many customers living...
  37. D

    Comp Sci Troubleshooting "Cannot find symbol" JAVA Error

    Homework Statement Why am I getting an error message "Cannot find symbol" Homework Equations The Attempt at a Solution
  38. S

    Java Program in JAVA which simulates the solar system

    Hi I need to write a program in JAVA which simulates the solar system. I'll be using the Beeman's algorithm seen here: http://en.wikipedia.org/wiki/Beeman%27s_algorithm" My question is that if I have the vectors for : velocity, acceleration and position how do I decompose them into there x...
  39. iamjon.smith

    Comp Sci Java Program Input from file, output to file(s)

    Develop an application that reads city, state, and population from a text file. Example input census file: Jamestown FL 50000 Domville CO 10000 Jennyboro FL 30000 Lillyville CO 5000 If the population of the city is greater than or equal to 50,000, write the city information to a text...
  40. iamjon.smith

    Comp Sci How to Build a Java GUI for Recording City Populations to a Text File?

    Develop an application that reads city, state and population entered from the user and writes this information to a file. The application should continuously prompt for this population information until terminated by the user. Example file: Jamestown FL 50000 Domville CO 10000 Jennyboro FL...
  41. iamjon.smith

    Comp Sci JAVA Animated Logo DUE TODAY HELP

    JAVA Animated Logo **DUE TODAY** HELP! My instructor has provided the code to use, we were told to simply modify the images for the program to work with our logo. The code comes straight from the textbook. I have followed the steps of my instructor but when I run the program I get the...
  42. iamjon.smith

    Comp Sci Java Graphics & 2D Help me animate this

    Java Graphics & 2D Help me animate this! Instructions : Using Graphics and Graphics2D, create a neon sign for your business logo. Create your logo to include a shape and the name of your business. The logo should flash off and on continuously. You may get as creative as you wish with your...
  43. J

    Java Reversing a Sentence with Java - No Loops

    We are asked to reverse a sentence , example: I am going. ==> .going am I Attempt: import java.util.Scanner; public class Assign2 { public static void main (String [] args) { String line= new StringBuffer().reverse().toString(); String line2 = new...
  44. iamjon.smith

    Comp Sci How to Create a Functional Java GUI Mortgage Calculator?

    Ok, Here is the assignment: Develop a mortgage payment calculator. Design a GUI to enter price of home, down payment, interest rate. Your bank only offers 10, 15, and 30 year mortgages. Use grouped radio buttons to select between 10, 15, or 30 year mortgage. Monthly payment should be...
  45. Y

    Java Opening and operating programs in java on a mac

    I started taking a java course at my school and we are required to use macs. I looked for how to open other programs like text edit or the terminal but the code segments I found only worked for java. Is it possible to have a java program open other programs like text edit or the terminal on a...
  46. J

    Java How Can I Display Each Digit of a Four-Digit Integer on a Separate Line in Java?

    Write a program that reads four-digit integer as a string , such as 1998 and then displays it, one digit per line, like so: 1 9 9 8 Attempt: Scanner keyboard2 = new Scanner (System.in); String integer2= "Input a 4 digit number:"; System.out.println(integer2); How do I make it read...
  47. iamjon.smith

    Comp Sci Why Does Java Show Cannot Find Symbol Error Despite Correct Constructors?

    /* * Use Ticket as the superclass. WillCall, eDelivered, and Printed are subclasses Ticket. * All tickets have event name, date, time, event location, and ticket cost. * WillCall tickets have booth location attribute. * eDelivered has an email address attribute. * Printed has a mailing...
  48. iamjon.smith

    Comp Sci Tic Tac Toe Game | Two Player | 3x3 grid

    Assignment: TicTacToe and TicTacToeGame. The TicTacToe class contains a 3x3 two-dimensional array of integers. The constructor should initialize the empty board to all zeros. It should have a method playerMove that accepts two integers as parameters, the first is the player (1 or 2) and the...
  49. iamjon.smith

    Comp Sci Solve Java Array Issue: Unique Numbers 10-100

    Simple Array assignment, directions as follows: (Must be implemented using a one-dimensional array.) Write an application that inputs ten numbers from the user, each number can be between 10 and 100, inclusive. As each number is read in determine if it is a number already entered. If it is...
  50. A

    Comp Sci Display city and time by Longitude in JAVA

    Java Help! I have Duty for my Jave class, My teacher needs to disply city and time by Longitude. which I set up to GMT but I have trouble problem. code seems to me work fine, I can't figure out wht's problems. it will be nice to get from you help. package worldclockdriver; import...
Back
Top