32,204 Topics

Member Avatar for
Member Avatar for plasticfood

i have a private Node class with a getValue() method that returns the Node's value which is of generic type. In another class i've tried doing this: T tempItem = null; ----also generic tempItem = currentNode.getValue(); I get a complier error unless I cast it like this: tempItem = (T) …

Member Avatar for plasticfood
0
231
Member Avatar for silverkid

why do i get this syntax error at the line shown below [CODE]package org.temp2.cod1; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.io.*; public class Code1 { byte[] plaintext = new byte[32]; // <<<<<<<<<<<<<<<<<<<<<<<<<< syntax error for (int i = 0; i < 32; i++) { plaintext[i] = (byte) (i % …

Member Avatar for LaughingOtter
0
22K
Member Avatar for roshan janyani
Member Avatar for krovi

what is wrapper calss .where can we use wrapper class in java.give me one example?

Member Avatar for JamesCherrill
0
110
Member Avatar for rahul.ch

The o/p is 10. But shouldn't it be 9? Is it got anything to do with Postfix or variable scoping has a role to play?

Member Avatar for rahul.ch
0
170
Member Avatar for borchu

Hello everyone, I am new at Java(android)-before I have little information about Java lang- and in particular socket programming -before I do not know nothing about socket client server programming-, previously I wanted to write simple chat program by using Threads and now I pass this step, two android emulators …

Member Avatar for borchu
0
976
Member Avatar for George2

Hello everyone, When using the following source codes to play a local .wav file, I always find .wav files can not played. Does anyone know what is the trouble? [Code] import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; public class …

Member Avatar for stultuske
0
978
Member Avatar for rahul.ch

Compiles fine. But at runtime it gives ClassCastException. My doubt is that why is it so even though st which is of type Sample1 gets casted to Sample2 and generates exception even though Sample2 IS-A Sample1.

Member Avatar for rahul.ch
0
243
Member Avatar for chuckc

I have an odd problem with a Java-based Internet program that I would like to use on a regular basis on my Windows XP computer. I have not done Java programming, so I would be interested to know if anyone has ideas about what might be happening. The program runs …

Member Avatar for chuckc
0
240
Member Avatar for vanushka.m

Iam working on a attendance management project to get inputs from fingerprint scanner and save it into mysql database such as date and time and also to vertify the staff members. If anyone could assist it would be a great help.

0
43
Member Avatar for greg2186

I'm a beginning programmer and am stumped on the last part of this assignment. I can't seem to figure out how to have the Letter Grade show. Here's what I have so far, any help as to where I'm going wrong would be much appreciated!! import java.util.Scanner; public class Lab1 …

Member Avatar for greg2186
0
1K
Member Avatar for dantheman4

public static void drawIndentedLine (int spaces, String begin, int n, String middle, String end) It should print a single line, terminated with a newline, that begins with the specified number of spaces, followed by the begin string, followed by n copies of the middle string, followed by the end string. …

Member Avatar for NormR1
0
184
Member Avatar for krovi
Member Avatar for dantheman4

package cs1410; import javax.swing.*; public class P2 { public static void main(String []args) { drawDiamond(); } public static void drawDiamond() { int x,y,z; int a=1; String out="\n"; int i=Integer.parseInt(JOptionPane.showInputDialog("Enter your size")); if((i%2)!=0) { int in=(i/2)+(i%2); int bb=in-1; int b=bb+(bb-1); for(x=in;x>0;x--) { for(y=x;y>1;y--) out+=" "; for(z=0;z<a;z++) out+="*"; a+=2; out+="\n"; } for(x=0;x<in-1;x++) …

Member Avatar for JamesCherrill
0
237
Member Avatar for calculuskatie

Write a program that does the following: a) creates an array of user specified length of random integers between 0 and 100. b) allow user to print array in ascending or descending order. c) allow user to search for specific int value (you can use your code from part 2) …

Member Avatar for stultuske
0
178
Member Avatar for Seswing142

1. Write a program to compute the annual rate of return on an investment. The program will ask the user for the original purchase price, the number of days the investment was owned, and the final sale price. The program must then print out the difference between sale price and …

Member Avatar for Seswing142
0
349
Member Avatar for im abcd

My program on compound interest gets compiled fine but it won't display anything . Yesterday When I created a new class and tried to run a simple for loop , the same thing happened . But when I tried to run the same for loop in a previously made class …

Member Avatar for im abcd
0
252
Member Avatar for MistaGeorge

I have a 2D array and i am trying to look for Similarities in the data, via number patterns. For Example: 1) 3,4,5,6,7 2) 1,4,8,23,56 3) 14,15,16,34,45 Now what i would like to do is search this array to find patterns like in example 1. it goes 3,4,5,6,7 or in …

Member Avatar for delta_frost
0
1K
Member Avatar for borchu

Hello everyone, I have problem with my simple android chat program when using different test debugging. I have two android emulators one reads SERVERPORT as 8080 and CLIENTPORT as 8082 and the other android emulator reads SERVERPORT as 8082 and CLIENTPORT as 8080 from a given txt file. Here there …

Member Avatar for borchu
0
2K
Member Avatar for borchu

Hello again, I have been posting consecutively in these days nearly same topics, actually I am intern at a sofware company and our company ask to perform the proof of conception about sending voice call -at the beginning- and finally video calls, like walkie talkie application; as you have already …

Member Avatar for borchu
0
245
Member Avatar for sanilo

Hi ! I have a JFrame which contains some textfields and buttons. imagine a situation that a user wants to fill sth in textfield, then she/he needs more textfields to be shown ! I want when the user clicks a button, more textfields will appear ! its like cc/bcc in …

Member Avatar for JamesCherrill
0
194
Member Avatar for ganges

hi how to install jdk and eclipse j2ee IDE on "Ubuntu Desktop 12.04 LTS" thanks for your time

Member Avatar for stultuske
-1
70
Member Avatar for Johannady2

When you enter "y" and try again. it doesn't asks you to "enter a String: " and "enter another String: " again. It just prints those lines out but you don't get to enter. Well~ you can enter 1 string again when it does the loop but I don't know …

Member Avatar for Susith Anuranga
0
348
Member Avatar for Lindsey1211

Hi, I just started working with Java for a class and Im a little confused. My code is supposed to convert seconds to hours, minutes and the remainder of seconds. for whatever reason my answer is 8 seconds off of what it should be. The example I was given is …

Member Avatar for Lindsey1211
0
123
Member Avatar for SSagar

Hi, I am struck in accessing c functions from java. I have .lib file and 5 dll files which are interdependent. I need to access the c functions in java. Please help me. i have no idea on this. Thank You, Sagar

Member Avatar for JamesCherrill
0
212
Member Avatar for lj81

Hey just a question to prove me right or wrong. I am wondering what the 'this' in the following code refers to in terms of my applet. mainThread = new Thread(this); I believe that it refers to the run method which defines the thread. I was told I was wrong …

Member Avatar for JamesCherrill
0
114
Member Avatar for gimmeuheart

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package buttontest; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * * @author noorulrafiedza */ public class ButtonTest extends JFrame { private JButton Button , Button1,b; private JPanel Group; private JCheckBox cek1; …

Member Avatar for harinath_2007
0
1K
Member Avatar for ITHope

I have to create a java program using either a regualr array or arraylist so I chose arralist and I named it horses but now have to create another method with in the programming inorder for a user to input/search for "trigger" and if it is found it shows the …

Member Avatar for javaAddict
0
316
Member Avatar for vinnitro

This is my program for Biodata in applet using JFrame import javax.swing.*; import java.awt.*; public class Biodata extends JFrame { JLabel jlname,jladd,jlmobno,jldob,jlgender,jltab,jlhob,jllang; JTextField jtname,jtmobno; JTextArea jtadd; JComboBox jcd,jcm,jcy; JRadioButton jrm,jrf; ButtonGroup bg; JTable jtedu; JScrollPane jsp,jshob; JList jlhobby; JCheckBox jc1,jc2,jc3; JButton jb1,jb2; JPanel jpr,jpcombo,jpcheck; JFrame jf; Biodata() { jf=new JFrame("Biodata"); …

Member Avatar for vinnitro
0
1K
Member Avatar for dantheman4

I am supposed to use this method public static void drawIndentedLine (int spaces, String begin, int n, String middle, String end) This is what I am suppsed to do **It should print a single line, terminated with a newline, that begins with the specified number of spaces, followed by the …

Member Avatar for dantheman4
0
351

The End.