32,204 Topics

Member Avatar for
Member Avatar for daudiam

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 …

Member Avatar for daudiam
0
204
Member Avatar for gedas

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 …

Member Avatar for gedas
0
123
Member Avatar for arshi9464

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........

Member Avatar for hertze_bogdan
0
104
Member Avatar for redflame777

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 …

Member Avatar for javaAddict
0
320
Member Avatar for softswing

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(); } …

Member Avatar for softswing
0
2K
Member Avatar for smmk143143

[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 = …

Member Avatar for smmk143143
0
233
Member Avatar for smmk143143

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

0
148
Member Avatar for tammy12w

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 …

Member Avatar for seanbp
0
103
Member Avatar for Johnsupertramp

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 …

Member Avatar for Ezzaral
0
189
Member Avatar for khaled_jawaher

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 …

Member Avatar for Ezzaral
0
176
Member Avatar for churva_churva

[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]

Member Avatar for Akill10
0
132
Member Avatar for jemz

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 …

Member Avatar for Akill10
0
151
Member Avatar for prem2

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

Member Avatar for prem2
0
676
Member Avatar for vinithktp

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 = "&nbsp;"; String convStr = newStr.replaceAll("'",rpcStr); [/CODE] Thanks in advance, Vinith

Member Avatar for ~s.o.s~
0
104
Member Avatar for misszeze

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 …

Member Avatar for JamesCherrill
0
89
Member Avatar for daudiam

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 …

Member Avatar for ~s.o.s~
0
685
Member Avatar for varunsara
Member Avatar for mag12203

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 = " …

Member Avatar for GuruMS
0
133
Member Avatar for warlord902

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 …

Member Avatar for warlord902
0
1K
Member Avatar for Akill10

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 …

Member Avatar for Akill10
0
168
Member Avatar for superirale

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

0
128
Member Avatar for atinus cool
Member Avatar for masijade
0
104
Member Avatar for rational_

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 …

Member Avatar for quuba
0
179
Member Avatar for doom2100

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 …

Member Avatar for doom2100
0
133
Member Avatar for jpaterson2525

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)

0
58
Member Avatar for arshi9464

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 …

Member Avatar for ishaanarora
0
110
Member Avatar for Ralphael
Member Avatar for JamesCherrill
0
141
Member Avatar for LianaN

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]

Member Avatar for LianaN
0
1K
Member Avatar for mag12203

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

Member Avatar for mag12203
1
156
Member Avatar for fenerista

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 …

Member Avatar for fenerista
0
3K

The End.