32,199 Topics
| |
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 … | |
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) { … | |
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. … | |
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. … | |
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 … | |
could u tell me plz how we can Radio Button in different location as wel as in image atachment. | |
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, … | |
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 ? | |
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; } … | |
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 … | |
Can anyone please explain what is 'public' and 'private' in oop and specifically in java? I am a bit confused. | |
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, … | |
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 … | |
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 … | |
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. | |
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 … | |
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.. | |
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. … | |
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 … | |
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 … | |
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 … | |
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() … | |
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"; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … |
The End.