32,204 Topics
| |
i know what an interface is. but i dont understand what the use of connecting the objective reference to the interface method and then use it to implement.. could someone explain to me the code..whats going on/ [CODE] interface TextReceiver { void receiveText( String text ); } class TickerTape implements … | |
Ok, I'm really confused here. I know that the only way to transfer objects via input/output streams is if they are serialised. If i wanted to transfer objects of my Person class from my client to server, I would have to implement "serializable" in my Person class. That's all well … | |
Here is the code... Problem is that it shows a message retCode is not initialized if i written last line in try block it shows return error i dun understand wat to do now plz friends help me private boolean spellCheck(String spell) { Connection Conn; Statement Stat; ResultSet Rs; String … | |
| Hey i have made a basic chat application in Java using the code from killer game programming in Java. but the problem with this is its just a big open CHAT ROOM so that anyone can log in and just talk/spam. i was wondering how to make a private chat … |
Hello everybody. I'm new to java programming. These days I'm developing a client server application using java. Client side is at most finish now. Server side logic is also designed and implemented successfully. But I'm in a trouble regarding following stuff. The server runs an infinite loop. it always checking … | |
I was wondering if i could incorporate swing, into the code to create a GUI?: [CODE]public class ComputerMerchandise { public static void main(String[] args) { java.util.Hashtable<Integer, Product> htProducts = new java.util.Hashtable<Integer, Product>(); for(Product product:Products.GetAllAvailableProduct()) { htProducts.put(product.getProductId(),product); System.out.println(product.toString()); } Hashtable<Integer,Integer> orders = new Hashtable<Integer,Integer>(); java.util.Scanner scanner = new Scanner(System.in); while(true) { … | |
I'm writing two classes for the main program code. I'm stuck trying to do figure out how to instantiate an object of the class Address: [B]Address class:[/B] [CODE]public class Address { private String city; private String state; public Address() { city = "?"; state = "?"; } public Address(String aCity, … | |
ok so the thing is im trying to save information from a register page into a file [code=java] else if(ae.getSource()==b1) { fname=t1.getText(); lname=t2.getText(); rol=t3.getText(); branch=cb1.getSelectedItem().toString(); username=t5.getText(); password=t6.getText(); username.savedata(); setVisible(false); } [/code] the username file is--- [code=java] package Proj; import java.io.*; public class username { public static void savedata() { try … | |
hey , my question is that suppose we have an application runnig . it has a jlabel with some text and now in some function i change the text by using setText()func and continue with some other stuff in the function , now the text that i changed is not … | |
i've made the following program that count how many times the input character is appeared in a string. [CODE]import java.io.*; class strngcls{ public static void main (String args[])throws IOException{ String s1,s2; char ch; InputStreamReader ir = new InputStreamReader (System.in); BufferedReader br = new BufferedReader (ir); System.out.println ("Type any Sentence: "); … | |
okay, I'm trying to create a new instance of SimpleCanvas through the FlagDrawer object. I need the SimpleCanvas to be scalable. I can only use the two instance variables and one constructor given to me. What I'm trying to do now is take the class instance variable (int) size and … | |
| I need help on this two assignments: # 1- Write a client and server, Java Swing application using socket connections that allows the client to specify a filename to the server in a Textfield and the server send the contents of the file back to the client if it exists. … |
[CODE]import java.util.Scanner; public class StudentList{ public static void main(String [] args){ Scanner console=new Scanner(System.in); String students[]=new String [10]; System.out.println("Enter names of students"); for(int i=0;i<students.length;i++) students[i]=console.nextInt(); System.out.println("Students entered are"); for(int i=0;i<students.length;i++) System.out.println(students[i]); } }[/CODE] | |
package com.inventory.servlet; pst=con.prepareStatement("insert into onscreen_record (add_name, price, zone, cinema, audi, priority, start_date, end_date, length_min, length_sec, client_detail)values(?,?,?,?,?,?,?,?,?,?,?)"); System.out.println(audi); pst.setString(1,add); pst.setString(2,price); pst.setString(3,"ok"); pst.setString(4,cinema[0]); for (int x=0;x<audi.length;x++){ pst.addBatch(); pst.setString(5,audi[x]); } pst.setString(6,position); pst.setString(7,sdate); pst.setString(8,edate); pst.setString(9,min); pst.setString(10,sec); pst.setString(11, client); pst.executeUpdate(); | |
Hi everyone! you can call me sprankitoy. I am a software developer. I'm a newbie in this discussion community so I might need your expertise should problems arise in the future. I'll be thrilled to answer questions and topics I can relate of specially regarding Java programming and RCP/RAP platforms. … | |
MY question is, like we do for integer and float, Integer.parseInt(args[0]) Float.parseFloat(args[1]) How do we take character input from command line ? | |
Last time i was facing a problem to connect or link to database for my java program. Actually i have to implement a reservation system, but then after i have sucessfully connect to database, i found out that i can do everything in database, then the class which i create … | |
I have the following code: [CODE]import java.util.*; public class Final{ private double guess = 1; public Final(double x){ root(x); } public double root(double b){ double rez = -1; if(Math.abs(guess*guess - b) < 0.001){ rez = guess; } else{ guess = (2/guess + guess)/2; rez = root(b); } return rez; } … | |
I would like to set and display a score that varies on how fast the correct answer was made. For example..a question would be answered for only a minute..and the score would be 20points for answering in the range of 1-10 seconds, 15points for answering in the range of 11-30 … | |
My offline data processing tool (written in C++) is being wrapped under webservices so that it can be executed remotely. We did that already - meaning we have a webservice that can kick off the data processing. However, for some reason, the very same webservice should not grab the data … | |
i know the concept of abstract class in java and this concept is used in interface, i.e all the methods declared in interface are abstract. i want to know how the abtract class is different from the normal class in java Thanks a million | |
Hi I'm trying to create a random number generator with float values ranging from -1 to 1 i.e.. [-1,1]. The only problem is I can only find methods that do it from [0,1]. Can anyone help me with this? Here is what I have so far.... [CODE]Random r = new … | |
my goal here is to create a new array from the old array according to a Criteria that i set (all numbers above 100 and even).. however the program gives me 2 mistakes, and i dont know why? [CODE] public class Array { public static void main(String[] args){ Manipulate manipulate=new … | |
Hi, I'm attempting to generate a new cipher key using a string that was negotiated earlier on. On running the code I get the error: Exception in thread "main" java.lang.IllegalArgumentException: Missing argument at javax.crypto.spec.SecretKeySpec.<init>(DashoA13*..) at shared.Cryptographer.makeCipher(Cryptographer.java:254) at client.Main.main(Main.java:60) Java Result: 1 the code is as follow: [CODE] public void makeCipher(String … | |
can anyone help me to construct the code: i dont know how to make the code of entering the operator ,the function of the operator when it was input and the output of the result . limit of the result is 500, Enter First Number:2 Enter Second Number:6 A=+ || … | |
[CODE] Integer i = 5; Integer j = 5; if (i == j) System.out.println("true"); [/CODE] ^ Prints true [CODE] Integer i = new Integer(5); Integer j = new Integer(5); if (i == j) System.out.println("true"); [/CODE] ^ Does not print true. I understand that in the second case, the == is … | |
Hey guys, check this out: [CODE] File test = new File(path + "person.data"); FileOutputStream fos = new FileOutputStream(test); ObjectOutputStream oos = new ObjectOutputStream(fos); Person p = new Person(); Person p2 = new Person(); p.setName("Sub Zero"); p.setGender("Male"); p2.setName("Sonya Blade"); p2.setGender("Female"); ArrayList<Person> people = new ArrayList<Person>(); ArrayList<Person> people2 = new ArrayList<Person>(); people.add(p); … | |
My friend; Please help. The green line below is working with a hardcode ApplicantId, and all I need is to make it work by passing the current ApllicantId column on the same gridrow. I tried for many days now, and something like the red line does not work for me. … | |
Hi everyone. I wonder why the following code doesn't draw anything. [code=java] package AssProgLang; import java.awt.*; import javax.swing.*; import java.util.*; public class AssOutput extends JPanel { public AssOutput(Queue translatedQueue) { this.translatedQueue = translatedQueue; outputFrame = new JFrame(); outputFrame.getContentPane().add(this); // outputPanel attributes outputFrame.setLocationRelativeTo(null); outputFrame.setPreferredSize(new Dimension(640, 480)); //this.setPreferredSize(new Dimension(640, 480)); outputFrame.pack(); outputFrame.setTitle("ASS™ … | |
This code should return the same object every time. there is a part that i dont understand in the code. why to use private identifiers and then set/get method? why to hide your code variables/methods? [CODE] public class SingeltonEx { public static void main(String[] args) { Singelton singelton=Singelton.getSingelton("Roni"); System.out.println(singelton.getName());//Roni Singelton … |
The End.