32,204 Topics
| |
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) … | |
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 % … | |
| |
what is wrapper calss .where can we use wrapper class in java.give me one example? | |
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? | |
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 … | |
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 … | |
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. | |
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 … | |
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. | |
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 … | |
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. … | |
How to add TrustStore file to cacerts in JDK 1.5 | |
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++) … | |
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) … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
hi how to install jdk and eclipse j2ee IDE on "Ubuntu Desktop 12.04 LTS" thanks for your time | |
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 … | |
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 … | |
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 | |
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 … | |
/* * 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; … | |
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 … | |
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"); … | |
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 … |
The End.