32,199 Topics
| |
Hello, I'm looking for a CSV parser and I found this example.... package com.ibm.ccd.api.samplecode.parser; import java.io.BufferedReader; import java.io.StringReader; import java.util.ArrayList; public class CSVParser { String oneRes; private String line = ""; private int nbLines = 0; private BufferedReader reader; public CSVParser(BufferedReader reader) { this.reader = reader; } public String[] splitLine() … | |
Hi guys. im writing a program to check an input string (a password) for its level of security (strong, medium, weak). here is my code for the method: public static int passwordType(String password) { //0weak, 1medium, 2strong int hasSix = 0; int upper = 0; int lower = 0; int … | |
hey this sounds like a really simple question to me but I can't seem to figure out how to do it! My code so far is public class numbers { public static void main(String[] args) { final int N = (args.length); for (int i = 0; i < N; i++) … | |
My program compiles but when I fun it I cannot get the city from the JComboBox to show in my JOptionPane. It shows up as "null" and when I click the clear button, nothing happens. I'm not sure how to fix these two problems. Here is my code: import java.io.*; … | |
hey guys so i am having a problem in my assinghmnet . i am making a text file and it has to import to java and make a table from the text file . so there is what the txt file looks. 3 // this should be the rows 1,2,3, … | |
Hey everyone! So I want to make a simple console based chat client as my first java project (ambitious I know) so here is what I have brain stormed as to What this program will entail (Let me know if I missed anything. * Cases (to handle arguments such as … | |
Hi. I'm writing a program that reads information from three seperate classes. public class Animal { protected int id,animalTotal; protected String type; protected double mass; //------------------------------------------------------------------------ // Sets up an animal with the specified ID number, type and weight. //------------------------------------------------------------------------ public Animal (int animalID, String animalType, double weight) { id … | |
So I'm working on a small calculator applet and whenever a button is pressed (generating an action event) i get this: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException. Something about a missing source? The variable m is an instance of my myFunctions class which houses all the necessary formulas. I believe the … | |
Hi there, I am trying to find an explanation for what the `findWithinHorizon()` does. I landed on this page http://docs.oracle.com/javase/7/docs/api/ and I know that the method is part of the `java.util.Scanner` class (isn't it?). How do I find it in the page above please? thanks | |
package prjarrays; import java.io.*; import java.util.Arrays; import java.util.Collections; class BubbleSorting { public static void main(String[] args)throws IOException { BufferedReader a = new BufferedReader(new InputStreamReader(System.in)); int []num = {54,92,04,98}; -> Arrays.sort(num, Collections.reverseOrder()); for(int str : num) { System.out.print(str + " "); } } } > cannot find symbol method sort(int[],java.util.Comparator<java.lang.Object>) why … | |
i'm writing a text based game that creates a world based on the data inside of the specified file. however, the code i have won't let me use the function DataInputStream.ReadFully(byte[]b) Code: package textgame; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Stack; public class world { Stack<String> LevelData = new … | |
Hi,I wish to simulate a traffic flow for a roundabout with 3 exits and be able to change how many cars enter and exit the roundabout and randomly turn off the exits. At a later stage I would also like to be able to input traffic lights to see would … | |
So this more than likely has a simple answer, but i cant seem to find it. I have a 2d array in one class, what I want to do is get this array into my other three classes. Now I'm not sure but I believe I have to use inheritance, … | |
import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; class oldEmployee { public static final int length = 0; static int empid[]={1,2}; static String Name[]={"name1",name2}; static String State[]={"state1","state2"}; static String City[]={"city1","city2"};; static String Area[]={"area1","area2"}; public Employee(int empid,String Name,String State,String City,String Area) { this.empid=empid; this.Name=Name; this.State=State; this.City=City; this.Area=Area; } public int getEmpId() { return … | |
I am trying to switch the below code to sort in descending order rather than ascending. It works when counting upwards, but nothing I try helps with getting it to count starting with the largest number and count downward. public static void insertionSort(Comparable[] list) { for (int index = 1; … | |
I'm trying to create a program that will draw an equilateral triangle with an oval at the center point when the mouse is pressed, and while the mouse is being dragged, the triangle will redraw itself so that the triangle remains equilateral regardless of where the mouse is (the mouse … | |
Hi, I am currently making an assignment for JAVA, but I get stuck at the following. I need to make a simulation of a shop where a customer puts objects in his "basket" and with that basket you go to the checkout counter. Now we have to make it possible … | |
I have this assignment for my java class, it runs fine, but the professor wants us to incorporate a private gradeExam method, which I don't know how it work fit, since I cannot call it from the DriverTest class which contains my main. package project6; /* A demonstration of how … | |
I posted this somewhere else but I think it was deleted so I'll post it as a new question... Here's my problem; I've been developing a packet sniffer using the Jpcap library from http://netresearch.ics.uci.edu/ . I was developing using the windows version of the java library, but now I realize … | |
Is it possible to get location in form of text through Google map using Android java? | |
Hi there, as one of my first programs in java, I thought I will do a simple (!) lottery program...needless to say it doesn't compile, and after looking at it for quite awhile trying to unsuccessfully spot the error (I am not sure how to debug in netbeans, any advice … | |
Hello, My problem is that I have a class, which needs to extend either one of two classes - the one it should extend depends on some value that is determined during runtime. I understand that there isn't a concept of having an if (this condition) extend thisclass else extend … | |
Create an applet for a calculator application in java program | |
Hi All... I am new to java, I am facing problem... Problem: 1) I want to create a ArrayList <String> and add Strings into it. problem: 2) I want to compare two Array List elements . their size and contents (strings type) which may be stored in any order. For … | |
I have the main part of my code done but I don'T know if I should use an action listener or an event listener for my JComboBox. I have 4 JComboBoxes and only need to retrieve the info from my vehicleBox and fuelBox at this point. I need to take … | |
I cannot get this to show up when I run it and I can't figure out whats wrong. import java.applet.*; import java.awt.*; import java.awt.event.*; import java.text.*; import javax.swing.*; public class TravelCostEstimator extends Frame implements ActionListener,ItemListener { //This part defines how the program will look Panel partOnePanel = new Panel(); Label … | |
This is a project I am working at my school as an introduction to two dimensional array. In this program, I attempted to create a two dimensional array, figure out how many neighbouring bacteria said cell have, and create, destroy, and leave the cell as it is. The error I … | |
I'm having tough time with netbeans. I am trying to add external image files to the netbeans project but confused where to place them. I copied the image files in every folder of netbeans(as i was tired) but nothing worked. Where exactly I should place the external resource files(images,videos,auidos etc).. | |
Hi, I would like to make a window with a given size, and a scrollable textarea to a given place within. When I tried the same with a button instead of textarea, it was no problem: make a JFrame, put a JPanel inside, put a JButton on the panel. Then … | |
i hav a shopping cart in java he columns of jtable are code-the item code qty-the quantity enterd by the user i want to update the quantity in database .the description of the table is code -item code stock-total stock in hand. i need to to update the quantity by … |
The End.