32,204 Topics
| |
Hello, is there any other method to compare string in java beside using equal() and == operator ? Thank you | |
This is the code that I have done so far: import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; class TSP extends JPanel{ int weight[][],n,tour[],optDist; final int INF=1000; public TSP(){ Scanner s=new Scanner(System.in); Random r = new Random(); System.out.println("Enter no. of Cities:=>"); n=s.nextInt(); weight=new int[n][n]; tour=new int[n-1]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ … | |
How can I figure out the time complexity of a program? The program is of the Travelling Salesman Problem. The aim was to implement the problem in two ways - Dynamic programming vs Simulated Annealing. Now I have to compare the two codes, find out which is faster and give … | |
My file: http://www.2shared.com/file/Y4I4l2kI/MysticWorld.html Convert to .class file please The errors: C:\xampp\htdocs\EMULADOR\Server\JAVAEX~1\org\MYSTIC~1\MysticWorld.java:221: error: illegal start of expression static class _cls5 ^ C:\xampp\htdocs\EMULADOR\Server\JAVAEX~1\org\MYSTIC~1\MysticWorld.java:277: error: malformed floating point literal switch(_cls5..SwitchMap.org.mysticworlds.WorldObject[type.ordinal()]) ^ C:\xampp\htdocs\EMULADOR\Server\JAVAEX~1\org\MYSTIC~1\MysticWorld.java:277: error: case, default, or '}' expected switch(_cls5..SwitchMap.org.mysticworlds.WorldObject[type.ordinal()]) ^ C:\xampp\htdocs\EMULADOR\Server\JAVAEX~1\org\MYSTIC~1\MysticWorld.java:277: error: case, default, or '}' expected switch(_cls5..SwitchMap.org.mysticworlds.WorldObject[type.ordinal()]) ^ C:\xampp\htdocs\EMULADOR\Server\JAVAEX~1\org\MYSTIC~1\MysticWorld.java:277: error: case, default, … | |
Hi, I have a problem while reading a jsp file. I have a jsp file called scan.jsp. It is a very big file having 9000 lines. It has java script codes, some imported files etc. Unable to read all lines of data when I try the following code. public static … | |
Hello, we are developing an application, where we got to call the service which is availbale on the some server. we did it on local server(localhost), and it is wroking fine..Now we want to deploy it on the real server and make is available.. My question is, is there any … | |
Hello everybody, I have some problems with my school assignment. I need to display a picture in a jlabel and i have already some code. Can someone give me some advice how i could get it to work. Thanks in advance. Greetz MeandJava [CODE]import java.awt.*; import java.io.*; import javax.swing.*; public … | |
This is my assaigment: Let's say that we can buy a candy from the vending machine for $1 each. Inside every candy is a coupon. We can redeem six coupons for one candy from the machine. This means that once you have started buying candy from the machine, you always … | |
Using NetBeans 7.3.1 i have created a JFrame. A JLabel fills the bottom of the JFrame . The JLabel displays an ImageIcon. I want the ImageIcon automatically resize itself when JLabel resizes. Generated Code from IDE : jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Number_theory/resources/primes_ulam_spiral.gif"))); // NOI18N jLabel1.setDoubleBuffered(true); jLabel1.setOpaque(true); jLabel1.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent … | |
I have this code that if i enter a number for example : Enter a number: 1 2 3 output is Even:2 Odd:1 Odd:3 but i like it like this: Enter a number: 1 2 3 Even: 2 Odd : 1 3 Here is My code hope you could help … | |
Hi all, I have just started to learn java. The trial code I have is showing errors at compiling. Here is the code. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; public class ppp { public static void main(String args[]) throws FileNotFoundException { //Scanner Example - read file line by line in … | |
i want to calculate the depreciation of an asset and i want my accumulated value to automatically add the previous monthly depreciation value with the current one any time the user calculates for the monthly depreciation, the accumulated value should pick the results from monthly depreciation and add it to … | |
Hello! can anybody please tell me the formula through which i can make the prime number program. I couldn't found the logic of it. | |
Hi! I am beginner in Java Programming and I am currently working with a program that randomly populate 14 buttons with a letter based on a given set of words and if the size of the word is less than the size of the button, it'll just populate it with … | |
I want to populate my jtable with columns from different table in mysql database but it only displays the column names and not the data or information under those columns. i hope this code helps u undertand what i mean. thanks private void Update_table(){ try{ String sql = "select Date_Acquired … | |
Hello! Im new to the java. During creating a program Im getting a warning "@suppresswarnings( deprecation )". I wants to know why is that warning occur and how to avoid it. | |
Im trying to take an amount of change, less than $1.00, but more than zero and display the number of quarters, dimes, nickels, and pennies that will be required to make that change. The output must be presented in a descriptive manner that resembles the English language with the following … | |
So I'm writing an event-driven program. The program is supposed to calculate checks and deposits, but the calculation comes out completely wrong. For instance, if i type 500 for initial balance, click 'entering a transaction', type 1 for checks, and type the amount 50 for transaction amount, the remaining balance … | |
how to code(program )a java spread sheet program using swing components | |
public static void removeEvensVer1( List<Integer> lst ) { int i = 0; while( i < lst.size( ) ) if( lst.get( i ) % 2 == 0 ) lst.remove( i ); else i++; } According to my understanding, shouldn't this method be N^3? Since you have a while loop (N) * … | |
Hie guys everytime I open uninstalled netbeans 7.3 and installed 7.3.1 but my projects which require javax.microedition.* are nolonger running. How can I add the package on the nebeans such that I don't have to refence them on each and every project. Thanks in advance | |
import java.awt.Point; import javax.swing.*; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPanel; public class painttest extends JPanel { private int pointCount = 0; private Point[] points = new Point[1000]; public painttest(){ addMouseMotionListener(new MouseMotionAdapter() {public void MouseDragged(MouseEvent event){ if(pointCount<points.length) {points[ pointCount ] = event.getPoint(); // find point ++pointCount; // increment number … | |
I have to convert it to using for loop from while loop. I don't know how to start with it :/ import java.util.Random; //to use the random number generator public class DiceSimulation { public static void main(String[] args) { final int NUMBER = 10000; //the number of times to roll … | |
Please how can i insert into two different tables in mysql using java. i tried this and its only for one table. so how can i insert into branches and items table simultaneously in the same code? try{ String sql = "Insert into asset_update (Date_Acquired,Item_Code,Serial_Number,Cost_Of_Acquisition,Estimated_Useful_Life,Depreciation_Start_Date,User,Status,Disposal_Date)values (?,?,?,?,?,?,?,?,?)"; pst=conn.prepareStatement(sql); pst.setString(1, ((JTextField)date_aquired.getDateEditor().getUiComponent()).getText()); String … | |
Hi, I am working in Matlab, I need help to write KNN algorithm. Please reply. | |
I'm trying to make a Palindrome program and this loop is giving me trouble: for (int i= 0; i < 79; i++) { character[i] = scan.next(); if (character[i] == ".") {break; } } The user enters a word, and when they are done, they enter a period, which is supposed … | |
| Hey everyone, I'm doing a practice problem and I'm stuck. The question is "Given an array a of n numbers (say doubles), consider the problem of computing the average of the first i numbers, for i ranging from 0 to n-1. That is, compute the array b of length n, … |
Hi there! I am new to the Daniwewb forum, and I was wondering if there was a forum or section specifically dedicated to promotions of books, ebooks, and articles on Java Programming. If you could please send me a link to get me pointed in the right direction or just … | |
Our program must create a guessing game that asks the user what the range they want to game to be and how many guesses they want. Once that is done it askes the user to make a guess and based on the guess its supposed to say Hot if it … | |
Hello everyone, I'm having some issues with my rock, paper, scissors JApplet program. Of course I have it "extends Applets" from the beginning of my class and I realized that this wasn't the same as JApplet. After I changed "Applet" to "JApplet", when I ran it, it doesn't look like … |
The End.