32,204 Topics
| |
Consider the following code : [CODE]class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } public static void main(String aa[]) { R2 nn1=new R2<Integer>(); nn1.set("hello"); (1) //String r=nn1.get(); //Integer t=nn1.get(); } }[/CODE] In line (1), an unchecked warning is given as the compiler … | |
hey, i am working on a web services (WS) program. i have a method in the server that reads text file and store every line of text in to a string array. on the client side, when i call the method it shows me that the value being retuned is … | |
I have a serious doubt for this:- Why do we give the url like c:\program files\java\jdk for user environment variables and c:\program files\java\jre for system environment variables? PLEASE HELP ASAP........ | |
Hi everyone, I am new to Java. I am taking a Java programming course and I am having some difficulty. My professor said I should seperate my class that stores employee information and calculates pay from the class that contains my main method. How do I do that? I understand … | |
Hai friends, please tell me how to write Junit for the below method, public static FileInputStream readAsFileInputStream(String fileName,String fileLocation) throws IOException { FileInputStream fileinputstream = null; File file = null; try { file = new File(fileLocation,fileName); fileinputstream = new FileInputStream(file); } catch(IOException ex) { ex.printStackTrace(); } finally { fileinputstream.close(); } … | |
[CODE]package myDxBall; import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.Shape; import javax.swing.*; import javax.swing.event.*; /* <applet code="myDxball.class" width=670 height=300> </applet> */ public class myDxBall extends Applet implements Runnable,MouseListener,KeyListener{ static Rectbar Recob[] = new Rectbar[45]; Thread th; int x_pos = 5 ; int y_pos = 50; public static int radius = … | |
[CODE] package myDxBall; import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.Shape; import javax.swing.*; import javax.swing.event.*; /* <applet code="myDxball.class" width=670 height=300> </applet> */ public class myDxBall extends Applet implements Runnable,MouseListener,KeyListener{ static Rectbar Recob[] = new Rectbar[45]; Thread th; int x_pos = 5 ; int y_pos = 50; public static int radius … | |
i am trying to get java SE development kit for my mac book pro (which has snow leopard) someone told my to download this java on the apple website but it did not work it just said this: This update requires Mac OS X 10.4.11 or higher. Mac OS X … | |
Hi, I would like to make a Java lottery simulator. This one is different than most, however. The program requirements are: 1) The patron enters his/her 6 chosen numbers (from the numbers 1 through 42 without duplicates) on the keyboard at the appropriate prompt(s). This same, single set of numbers … | |
i am new in jsp.i am trying to use useBean in jsp to run a class named hi. i am using apache tomcat as a web server.i placed the file hi.class as well as the file that i named it date.jsp which uses the hi class in the folder webapps … | |
[CODE] button.setToolTipText("Hello, World"); frame.add(button, BorderLayout.NORTH);[/CODE] This part is the main of my program..the main ok..but that class above somethind wrong please help me figured it out...... [CODE]public class ComponentDemo{ public static void main(String [] args){ JFrameWithManyComponents frame= new JFrameWithManyComponents(); } }[/CODE] | |
hello can you help me please how can input text with space.. sample: Enter your full name: jemz gimz Enter your company name: company one jemz gimz company one [CODE] import java.util.*; public class SampleNexLine { public static void main(String []args) { Scanner console = new Scanner(System.in); String name,cname; System.out.print("Eter … | |
Dear all, I want to connect the my mysql database in the below java program.But i could not able to connect the myslq database. i have downloaded the below jar file and put the jar file in the below path. Jar File: ========= mysql-connector-java-5.0.8-bin.jar Path: ==== /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/lib mysql version ============= … | |
Hi, I have a question regarding Memory Leak. The below mentioned JSP code can generate any Out of memory exception [CODE] String str = tempStrView.getSTR(); String newStr = str+"'"; String rpcStr = " "; String convStr = newStr.replaceAll("'",rpcStr); [/CODE] Thanks in advance, Vinith | |
hello I am developing a java application, in my application i have to move data with large size from one object to another and i don't know the perfect way to do it so i can save memory and increase the processing speed because performance is very important in my … | |
I can't understand the following statement [QUOTE]The Hotspot VM now implements Thread.yield() using the Windows SwitchToThread() API call. This call makes the current thread give up its current timeslice, but not its entire quantum.[/QUOTE] given at [URL="http://www.javamex.com/tutorials/threads/yield.shtml"]http://www.javamex.com/tutorials/threads/yield.shtml[/URL] I understand that after a thread yields, other threads get a chance to … | |
| |
I have been able to output a palindrome but now it does so even if it is not a palindrome. Thanks you in advance for any help. ;) [CODE]import java.util.*; public class ec2 { static Scanner kb = new Scanner(System.in); public static void main(String[] args) { String word = " … | |
So my problem is that, i have a text area with 3 rows. Its a part of a chat application which receives text from a user. I want to send the text and clear the text area as soon as the user presses the enter key. Now the problem is … | |
Hi, I've started to learn about threads in java. I'm trying to make this simple animation of a rectangle. Where am I going wrong? I was under the impression that if a class implements Runnable, when it is executed, it looks for the start method, which in turn starts the … | |
I want to Develop a 2d rpg game with java,how do i start and what do i need to know? I have been using java for two years.my team consists of two programmers and one graphic artists | |
how to generate code to get output- input-12345 output-1+2+3+4+5=15 | |
I want to join 2 dots of the same colour that is 2 red dots or 2 blue dots ....but after applying my code...when i run the program it does not join the 2 same colour dots...even though it does not display any error. So basically i am trying to … | |
hello all my problem is a confusion on the second problem here i managed to solve the first problem and made the program i hope its correct as u see.. First problem Three memory locations A, B, and C contain numbers. Write down the algorithm for finding and printing the … | |
I need to port an application i wrote in MS csharp to java. I used the WebBrowser control to deal with complex html and javascript. Whats the simplest solution for java? (im using swing components) | |
when we write [javac abc.java] a bytecode is generated. AND THE BYTECODE CONTAINS INSTRUCTIONS FOR THE JVM and each instruction is 1 byte in length. NOW my question is where does the interpreter comes into action and what happens after the bytecode is generated. I was told that interpreter produces … | |
| I need to create a serverless chat manager can some one help me |
Hi! How could I change custom cursor size? I was playing with Point(a,b), however the cursor is always 32x32 and it looks horribly. Below you can see my code snippet. Thanks! [CODE] Toolkit toolkit = Toolkit.getDefaultToolkit(); Image imageCrossCursor = toolkit.getImage(BeadToolbarColor.class.getResource("/icons/cross_cursor.png")); cross_cursor = toolkit.createCustomCursor(imageCrossCursor, new Point(0,0), "Cross cursor"); panel.setCursor(cross_cursor); [/CODE] | |
Can someone help me figue out why I keep getting an erorr that I am missing a return statement. [CODE] import java.util.*; public class ec1 { static Scanner kb = new Scanner(System.in); public static void main(String[] args) { String word = " "; String s = " "; char letter; … | |
How can I add a clickable url in a JTextPane like this [url]http://www.google.com[/url] or If I ask other way, how can I make the links in JTextPane clickable ? When the user click or double click this link the default browser will open the link that is clicked. I have … |
The End.