31,001 Topics

Member Avatar for
Member Avatar for cakka

Hello, is there any other method to compare string in java beside using equal() and == operator ? Thank you

Member Avatar for stultuske
0
338
Member Avatar for kal_crazy

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++){ …

Member Avatar for kal_crazy
0
1K
Member Avatar for kal_crazy

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for luan.augusto.9081

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, …

Member Avatar for JamesCherrill
0
279
Member Avatar for sasikrishnasamy

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 …

Member Avatar for sasikrishnasamy
0
258
Member Avatar for Trap910

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 …

Member Avatar for JeffGrigg
0
98
Member Avatar for MeandJava

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 …

Member Avatar for Ranjana_1
0
4K
Member Avatar for iTechnnn

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 …

Member Avatar for iTechnnn
0
166
Member Avatar for nikolaos

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 …

Member Avatar for JamesCherrill
0
670
Member Avatar for benjo.s.lucas

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 …

Member Avatar for benjo.s.lucas
0
118
Member Avatar for Madiya122

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 …

Member Avatar for Madiya122
0
505
Member Avatar for Benjamin_4

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 …

Member Avatar for cereal
0
2K
Member Avatar for ahmed.talha.16

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.

Member Avatar for uttkarshsing
-1
338
Member Avatar for techxaidz

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 …

Member Avatar for techxaidz
0
322
Member Avatar for Benjamin_4

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 …

Member Avatar for JamesCherrill
0
209
Member Avatar for ahmed.talha.16

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.

Member Avatar for jwenting
0
308
Member Avatar for Smith6969

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 …

Member Avatar for JamesCherrill
0
176
Member Avatar for dancingdophie

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 …

Member Avatar for javanoobcoder
0
268
Member Avatar for aminem2080
Member Avatar for JamesCherrill
0
24
Member Avatar for Kuroshi

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) * …

Member Avatar for JamesCherrill
0
79
Member Avatar for gtsiga

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

0
84
Member Avatar for vivosmith

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 …

Member Avatar for mKorbel
0
369
Member Avatar for woochoi24

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 …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Benjamin_4

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 …

Member Avatar for Benjamin_4
0
3K
Member Avatar for SAM2012
Member Avatar for masijade
0
89
Member Avatar for munchlaxxx

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 …

Member Avatar for jwenting
0
287
Member Avatar for siva28

I need javascript for automatic city display when i click one state from list box. for example one list box i fetch karnataka, then automatically cities display whatever cities there in karnataka in another list box . Please reply..am newbee of script writing....

Member Avatar for sameer.javed.10690
0
433
Member Avatar for jmartzr1

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, …

Member Avatar for JamesCherrill
0
229
Member Avatar for djslavens

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 …

Member Avatar for JamesCherrill
0
65
Member Avatar for Seswing142

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 …

Member Avatar for stultuske
0
499

The End.