32,199 Topics
| |
/** * @(#)GeometricObject.java * * GeometricObject application * * @author * @version 1.00 2012/9/10 */ public abstract class GeometricObject { private String color = "white"; public GeometricObject(){ } public GeometricObject(String color){ } public String getColor(){ return color; } public void setColor(String color){ this.color=color; } public String toString(){ return " the … | |
I need to override String toString method so it woud print my deposits I dont't know how to override it, since in makeDeposit method I pass two variables I'm posting just a saple of my code, I'm not sure if you need the whole code public class Bank { private … | |
Hi guys. I am having issues with the output of this program. Can somebody tell me what I have to do to make this work correctly? Here is the code I have so far: import java.util.Scanner; //text scanner to parse primitive types and strings using regular expressions. public class Operations … | |
public class asterisk { public static void main(String[] args) { int row, col, spc=3, spc1=2, spc2=1, spc3=0; for(row=1;row<=1;row++) { for(col=1;col<=1;col++) { for(spc=spc;spc>0;spc--) { System.out.print(" "); } System.out.print("*"); System.out.println(); { for(spc1=spc1;spc1>0;spc1--) { System.out.print(" "); } System.out.print("**"); System.out.println(); { for(spc2=spc2;spc2>0;spc2--) { System.out.print(" "); } System.out.print("***"); System.out.println(); { for(spc3=spc3;spc3>00;spc3--) { System.out.print(" "); } … | |
Hi.. I want redirect a frame into next frame. In swing method how to redirect a frame into next frame ? | |
Hello All, I have a Java program which is using a JOptionPane in it. eg. Are you sure u want to close the application? Yes No When I click with the mouse on the No button it works correctly but if I select the No button using the TAB key … | |
I want to do this: When I press on a checkbox 'Monday', the program displays the List 'lstMonday' When I press on a checkbox 'Tuesday', the program displays the List'lstTuesday' How can I achieve this? I've tried to do it ut can't:( Thanks in advance | |
Hello everyone, I have question about how AudioTrack instance should be used for streaming applications. Below my code example and some brief explation about code ... /* some work before */ InputStream in = client.getInputStream(); AudioTrack output_stream = new AudioTrack(AudioManager.STREAM_MUSIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT, 8192, AudioTrack.MODE_STREAM); byte[] buffer = new byte[8192]; … | |
hy!!!!i am trying to write a java code that returns the majority element in an array and -1 if not!!this is what i came with public class Majority{ public static int arrMajority1(int A[]){ int n = A.length; int c = 1; for(int i=0;i>A.length;i++){ for(int j=i+1;j<A.length;j++) if (A[i]==A[j]) c=c+1; if (c>(A.length/2)){ … | |
I'm trying to use limesurvey but cannot get the slider as i would like it. Here is a link to the surveyquestion: http://adam.synology.me/limesurvey/index.php/survey/index/sid/164171/newtest/Y/lang/sv I want the images to change according to the value of the sliders. With a regular html form i had this to take care of it: <script … | |
Hello All, this is my first post, so bear with me... My problem is with the following code. I have a simple menu setup to do some number conversions, and everything compiles properly. When i run the code, i end up with the Java VM (in bluej) just running endlessly, … | |
how can we create accounting vouchers use in departmental store for selling products through jswing in java programming..?? | |
Hello, I am currently working on a project and I am stuck at the moment. Basically I have a few JToggles buttons, a jbutton and a text box. When the user select a jToggle button, write some text in the text box and clicks on the Jbutton, the text on … | |
Javascript is a object oriented programming language.It is a flexible language.This loosely programming language has its own built-in datatypes.It offers three primary data types,two special data types and two composite data types. -> The primary data types are :- (1) Boolean (2) Number (3) String -> The special data types … | |
/*Ok I have code that's behaving unexpectedly The following program is supposed to print prime numbers for n1=100,n2=1000,n3=10000 and n4=100000 except that for n1=100, it prints the squares of primes less than 10. I can implement this same program in c++ and wouldn't get such output. I need another pair … | |
1.Suppose a method is declared as: public static void f (double d, int n) { ....; } Which one of the follow method invocations would compile with no errors? Select one: a. f(2.5, 3.5); b. f(2, 3); c. f(2.5); d. f(3); I chose b 2.Each of the following pieces of … | |
Hello everyone. I am starting a class that utilizes Java for software design. I have no previous java experience, although I have taken c++ prior to this and appreciate all the help I have received in the past. I also would like to thank everyone in advance for all your … | |
any one help me in completing my program on FLAMES game i am not getting how to complete it please help me | |
Hi friends, I want to create an auto-evaluator for java.. If I submit java program, it has to run and show the output or exceptions(if so).. I tried in some simple ways, it doesnt works out. please give some suggestions how to start and progress... Thanks in advance... | |
I wrote a server class and a client class. again i wrote 4 different JFrame class which were connected with each other and some Puzzle game codes were written on this classes. I want to add those classes with the server. and want to play those games from the client. … | |
I have this code: static String format(String number, int decimalLength) { char[] decimal; System.out.println(number); String[] formatA = number.split("."); System.out.println(formatA.length); StringBuilder cents = new StringBuilder(""); int dollars = 0; dollars = Integer.parseInt(formatA[0]); decimal = formatA[1].toCharArray(); for (int i = 0; i < decimal.length; i++) { if (i < decimalLength) { cents.append(decimal[i]); … | |
I just completed one JAVA course. I used NetBeans. I ran into a friend recently who told me about Eclipse. In my next class I had to write a program with a GUI application. Which IDE do you prefer? Why? | |
Hi, I'm doing a study planner in java. I'm doing a simple login system. For every user who registers a text file is created holding all of the information inputted during registration. This is the code of a method which the program uses to login the user: public void loginUser(){ … | |
Why does first two eg give true when a check done on them using if(x==y) but 3rd and 4th case give false? eg1: `String x = "Hello", y="Hello" ` eg2: `String x = "Hello";` `String y= "Hello";` eg3: `String x="Hello";` `String y = new String("Hello");` eg4: `String x = new … | |
Hi every one!! I need help to match user data from database inorder to log in to admin panel. Here is what I am trying. it works ok but it is giving dialog box containing text "Sorry! You have no access to Database" here is the code. Please help String … | |
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? |
The End.