32,199 Topics
| |
so the question is to print out strings that appear both in the two given lists, assume each list does not contain duplicates of the same word. so with the signiture of [B]public void intersect(Node n1,Node n2)[/B] and suppose we already have another method: [B]public boolean contains(Node n, String target)[/B] … | |
Hi! please help me for how can i scroll through database using JDBC. if i m creating 4 buttons say First,Last,Next,Previous. First button will take me to the first record of the database. Last button will take me to the last record of the database. Next and Previous will show … | |
Hi I made a browser game with php and a little bit of java script, the ask a random question, then i dynamically load answers as image links, which the participant should select the correct one, if it is then he will go to the link the image href points … | |
I need to make this a popup when a button is clicked. This is the code for the Button. [CODE] JButton moreOptionsButton = new JButton("More Options"); moreOptionsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { timer.stop(); } } );[/CODE] I need this information to come up in a new window. … | |
Hi, I basically have 1 arrayList with 10 elements. [CODE] //arraylist with10 elements private ArrayList<String> arrayList1 = new ArrayList<String>(); //arraylist with nothing in it. private ArrayList<String> arrayList2 = new ArrayList<String>(); public void copy() { Collections.copy(arrayList1, arrayList2); } //The code above will copy all the elements in the first arraylist to … | |
I'm trying to make my for loop print ODD numbers and print their sum and average. Here's my code: public class Loop_For2 { public static void main (String[] args) { double sum = 0f; int ctr = 1, ctr2 = 0; for (;ctr<=10; ctr++, ctr2++) { System.out.println(ctr); sum += ctr; … | |
I'm not sure why it's not calculating right. When I enter a negative number, the if else statement or something does not register it's a negative number. There is a before and after, and you can see where it does not register negative numbers. Thanks in advance for your help! … | |
Hi there, I'm having a weird error, When I click on my submit button my eventhandler that should be capturing the data from my JTextField is throwing an error : This is my first week using Java so I'm sorry if this is a newb thing. My Main function simple … | |
Been working on this for 2 hours non stop. Can't seem to figure out exactly what's the problem. Perhaps I'm taking a wrong approach to this problem. Right, I need to copy a singly linked list to another new list. Can use any method EXCEPT RECURSION. Here's the code so … | |
Hello I just started working with JTabbedPane tabs. I have been using the index to navigate the pane. Now I add and remove tabs from the pane so clearly the index navigation is no good. Does anyone know some code for an easy solution for using the title or something … | |
I am good at created a little block diagram; however, I struggle with tracing these out and I have a midterm in a few hours. I am confused about all the casting and also about #4 and #7. I thought #4 would be a compiler error because the "Decared Type" … | |
Hi, Im new to java, mostly done networking in the past, im trying to create a program that will run a basic simulation of a number of heats for a 100m sprint. It mostly about the use of collections so nothing to complex but im completly lost. I've created a … | |
Here is the start of my program. I am having a little trouble linking the farToCel/celToFar user defined methods with the final equations in the action statements. The output is whatever the user enters and 0 for "fah" and "cel". Example: displayTF.setText(inputTF.getText() + " Celsius is " + cel + … | |
plz help.....in solving this problem While developing the Virtual University Learning Management System (LMS), there was a requirement stated that: “Students should be able to post their questions on MDB of LMS, so that it may help them to clarify their concepts in case of any confusion, after they have … | |
So I have an array and I need to get the values of it that are larger than a set integer. It would be something like this apart from it doesn't work due to different data types. [code]myVariable = array[i]>otherVariable;[/code] where myVariable and otherVariable are integers. Any help? | |
Hello all, This is a very simplistic simulation but i'm hoping to show bacterial growth using this simple piece of code. [CODE]public class Bacteria { boolean living; Bacteria x; int population; public void spawn() { living = true; try{ Thread.sleep(2000); } catch (InterruptedException e ) {} Fission(); try{ Thread.sleep(100000); } … | |
Is there no such thing as hasNextChar? I'm trying to make a program to figure out a grade point average, and a solution I've come up with to deal with the +/- is to assign it as a char and give it a value from there, but I run into … | |
I made a flowchart that will print counting numbers 1-10 automatically, and I'm supposed to print their sum and average at the end. Now, I have to convert the flowchart into three Java programs: For, While, DoWhile. I'm having a bit of a problem on the flowchart and the programs. … | |
Hey .. Everyone ... I'm now to java .. I'm trying to figure out .. how everything fits together .. well .. i have a project that I'm working on .. .. basically it a type of quiz working on java .. where a user takes a simple MCQ quiz … | |
Thank You .. EveryBody .. for Your Support .. Finally Got my Project Working again .. Now.. Im facing Only 1 Problem .. The JRadioButtons .. Remain selected even when I get to the next Question .. the Previous selection .. remains .. Selected.. any help how i can .. … | |
The question is asking: A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 20 random die tosses and that prints the die values, marking the runs by including them in parentheses, like this: 1 2 (5 5) 3 1 4 6 1 … | |
[CODE]import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import java.util.Arrays; import java.util.NoSuchElementException; public class ReservationBook { private Reservation[] data; public Reservation[] readFile(String filename) throws IOException { FileReader reader = new FileReader(filename); try { Scanner in = new Scanner(reader); boolean done = false; while(!done) { try { int numberofR = in.nextInt(); data = … | |
I am sort of told that O(c^n) complexity could be the case of string permutations. but what is this specific 5^n? can anyone think of a simple algorithm with O(5^n)?thx | |
I have a ArrayList and JTable load Object from ArrayList to display on table. When i sort table by using method: [CODE]table.setAutoCreateRowSorter(true);[/CODE] by using that method, i can sort table by clicking on header of the column i want to sort! But after sort, the Object of row which i … | |
I have Brought a voucher For SUn JAva EXAM ,So where do u register for this exam ,cant find any links on SUN site And WHICH SUN JAVA EXAM should i give first SCJP OR some other??????????? | |
here is some code from one class... [CODE]public boolean ticketStatus(){ if (fine > 0){ status = true; } else{ status = false; } return status; } [/CODE] and this is from another class... [CODE]public void getTicket(){ if (parkingticket.ticketStatus()){ toString(); } else{ System.out.println("you do not have a ticket. "); } } … | |
Hi all, I am using java bean class in my web application(it is not extending servlet).My need is to get the context path of the application in that class.If yes how. I am using "./".It doesn't work. Please help me | |
Currently working on a project where we have a message board server. I've gotten most everything to work except my last part where we want an arrayList that returns Oldest Messages and one for newest messages. Here is what I have so far and have tweeked and commented out some … | |
Hi, I need to know if we can use the if satament with methods and how? and what is the illegal start of expression? | |
The problem: Java will not install on my laptop. My laptop was purchased a little over three and a half months ago. It is an eMachines 440-1394; Windows 7, two Gb RAM, 250 Gb HDD When I purchased the laptop, I was able to install openOffice (with Java? I am … |
The End.