32,199 Topics

Member Avatar for
Member Avatar for kdmuk10

I was trying to find the smallest common divisor for the numbers from 1 to 20. I tried the following code. My problem was how to get back to the beggining of the for loop after the if test has found the number is not divisible. But then i added …

Member Avatar for kdmuk10
0
104
Member Avatar for mangopearapples

I'm trying to make it so when I press ESC, it RestoreScreen() but it doesn't work. Now I don't know whether it's my method RestoreScreen() or my listeners. This is my code: [code]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class main extends JFrame implements MouseListener,KeyListener{ public void keyPressed(KeyEvent e) { …

Member Avatar for roxin_phoenix
0
184
Member Avatar for gazzatav

I'm reading a book called Beginning Algorithms by Harris and Ross, which gives code examples in Java. As an academic exercise I am trying to convert the code examples to C++. In the interface below the part that throws me is the return of the 'Object' by the 'current' method. …

Member Avatar for gazzatav
0
423
Member Avatar for DanieltheE

hello all, this is my first post here and I have searched for answers elsewhere before asking for help. My code is pretty tight, but I keep coming up with symbol not found errors. Are my curlys not in the right place? Or have i not declared the objects correctly. …

Member Avatar for JKP()
0
153
Member Avatar for newcoder310

Hi I'm new to programming so I need a little help with packages. I have created 2 packages test1 and test2 with p1.java and p2.java respectively. Both have default access. I'm trying to extend p1 with p2 and have tried to import test1 but the error im getting is that …

Member Avatar for JKP()
0
95
Member Avatar for scobi

could u tell me plz how we can Radio Button in different location as wel as in image atachment.

Member Avatar for scobi
0
73
Member Avatar for daudiam

I understand that int values, when autoboxed, are interned i.e no 2 objects containing the same int are present, and so we can compare two Integers by == So why does the following happen :[CODE]Integer iRef1=1000; Integer iRef2=1000; System.out.println(iRef1 == iRef2); System.out.println(iRef1.equals(iRef2));[/CODE] This prints [CODE]false true[/CODE] On the other hand, …

Member Avatar for daudiam
0
125
Member Avatar for daudiam

Why do local inner classes not allow static variables ? The static fields of the classes could at least have been allowed access from the local method ?

Member Avatar for ~s.o.s~
0
163
Member Avatar for seun101

public class Account extends javax.swing.JFrame { /** Creates new form Account */ public Account() { initComponents(); setTitle("Bank Account"); jTextArea1.setEditable(false); } /** * @param args the command line arguments */ private int accountNumber =0; private double balance =0; public Account(int accNum, double bal) { accountNumber = accNum; balance = bal; } …

Member Avatar for JamesCherrill
0
94
Member Avatar for gedas

hey, i got a method that returns value which is java.util.List<java.lang.String>. this method actually contain data that was stored from .txt file which is simply names of people. how can i display this in the JList or how can i convert this value to a simple array so later i …

Member Avatar for quuba
0
228
Member Avatar for kangkan_14

Can anyone please explain what is 'public' and 'private' in oop and specifically in java? I am a bit confused.

Member Avatar for kangkan_14
0
274
Member Avatar for billy leung

Hi everybody, actually i am new to Java, and i would like to write a program that to find who is a copycat, for example, i get six txt file, all of these are juz put inside a folder, i guess i should get all the txt file to array, …

Member Avatar for billy leung
0
175
Member Avatar for in._.cloud

Hi to all I have one question about error in my code.. If I have compile the code in the NetBeanse , not found any error .. but if compile it in Command Line, I have errors. I attached my post with the code and 3 picture of run include …

Member Avatar for pbl
0
38
Member Avatar for renovatiotr

I got that code from [URL="http://www.javafaq.nu/java-bookpage-19-3.html"]here[/URL]. Everything's working except the balls! There is panels, splitpanes etc. Oh Look, no balls! I need to solve it like in an hour. Please help. I say again; please... [CODE]import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; public class Split …

Member Avatar for Akill10
0
108
Member Avatar for jaycastr

Hey guys im getting back into Java after a break from programming. And i was wondering what is the best integrated development environment for running java.Im sure there is no one Best, but your input would be greatly appreciated.

Member Avatar for Akill10
1
455
Member Avatar for AndrewSD

Does anybody know any good tutorials on how to make a web crawler in Java. All I can find is a bunch of code that you have to figure out own your own! I am pretty new to the forums, and have a pretty good experience in java. So..... Any …

Member Avatar for KirkPatrick
0
92
Member Avatar for JKP()

Im new to java and I would like to participate in some small projects.. let me know and I'll be glad to work with yha..

Member Avatar for JKP()
0
92
Member Avatar for دموعي

Create a JAVA applet program that accepts and displays object‟s details on respective GUI components. The Applet consists of seven GUI components such as two labels Name and Price followed by two textfields of size 10 respectively. There are two buttons labeled as ADD and DISPLAY followed by a Textarea. …

Member Avatar for دموعي
0
98
Member Avatar for peter_budo

I'm trying to get hang of custom events and listeners. I found example of single event-listener, but I'm curious how to extend from single method to multiple that are related. [code=Java]public interface CountListener{ public void countEvent(int count); public void multiplyEvent(int multi); }[/code] [code=Java]public class Counter implements CountListener{ public void countEvent(int …

Member Avatar for svedrenne
0
3K
Member Avatar for arshi9464

i am unable to understand WHAT MAKES THE BYTECODE IN JAVA, MACHINE INDEPENDENT. I mean how does the bytecode built after compilation becomes machine independent, or what are the properties that make the bytecode machine independent? EXAMPLE:- If i compiled a program on a x86-64 machine and after sometime i …

Member Avatar for ~s.o.s~
0
168
Member Avatar for softswing

Dear Friends, Am using inifile management,want to read and update ini files, for this am using properties class methods (below). but settings in ini files are changed while am updating, properties.load(inputstream); properties.put(writeIDName, writeData); please tell me how we can update inifile with out affecting the exisiting content in ini file,if …

Member Avatar for parry_kulk
0
173
Member Avatar for aligajani

I want to sort the getSal values in the myList. It should be a sorting algorithm implementation so that adding or removing objects does not affect the performance. [CODE]import java.util.*; public class payment { public String name; public int salary; void setName(String _name) { name = _name; } String getName() …

Member Avatar for aligajani
0
175
Member Avatar for khurram.1987

Hi, i am trying to connect to MySQL database [ICODE]mysql[/ICODE] using JAVA .. using code given below, [CODE]import java.sql.*; public class dbExample{ public static void main(String[] args) { System.out.println("Listing all table name in Database!"); Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db = "mydb"; String driver = "com.mysql.jdbc.Driver"; …

Member Avatar for khurram.1987
0
157
Member Avatar for hao90

i[CODE]mport javax.swing.*; public class ReverseArray { public static void reverse(int b[]){ int left = 0; int right = b.length -1; while(left<right){ //exchange the left and right elements int temp = b[left]; b[left] = b[right]; b[right] = temp; left++; right--; } } public static void main(String a[]){ } } [/CODE] how …

Member Avatar for hao90
0
111
Member Avatar for daudiam

Consider the following codes : File : C3.java [CODE]package G; public class C3 { protected int a=5; }[/CODE] File : R3.java [CODE]import G.C3; class R2 extends C3 { void doit() { a=7; } } class R1 extends R2 { void doit(R2 b) { a=8; b.a=1; // (1) } }[/CODE] It …

Member Avatar for daudiam
0
206
Member Avatar for pigmario

Hi.. can anyone understand this piece of flowchart,i dont understand. the flow cart is in the attachment. and below is my source code implementation [code]input int n; int i=0,a,b; if(n>0){ while(i<a){ if(n>i){ if(n>a){ if(b>a) b=1; }else{ n=a; if(n*b >i) b=1; } }else{ n=1; } i++; } }[/code] i dont know …

Member Avatar for febrilian samo'
0
739
Member Avatar for cms271828

Hi, I have 2 applet problems. 1) I uploaded a new jar file to server to replace old one. When I load web page in browser for that applet (on this pc), I keep getting the old jar file getting loaded as the applet (even on different browsers on this …

Member Avatar for Akill10
0
226
Member Avatar for ms88

Hi there, I have some problem with accessing API using PHP. Here is the story : I use PHP as my main script on my webserver. I want to retrieve data in database server (oversea). The database server provides API and it's available to download. So I download the API …

Member Avatar for mdew_47
-1
898
Member Avatar for hao90

[CODE]public class Human { private String name; public Human(String name){ this.name = name; } public String getName(){ return name; } public String toString(){ return "Human " + getName(); } } interface Electrician{ public String changeBulb(); } interface Plumber{ public String unplugDrain(); } class HandyPerson extends Human implements Electrician, Plumber{ public …

Member Avatar for hao90
0
111
Member Avatar for gedas

hey, i have been asking for help for almost a week and there is no reply what so ever. from anyone ... please help i am so so so stuck and i have been stuck for days.. i am creating web services in netbeans (ws-jax) i want to return array …

Member Avatar for gedas
0
124

The End.