32,204 Topics

Member Avatar for
Member Avatar for rahul.ch

[CODE]class Mammal { String name = "furry"; String makeNoise() { return "generic noise";} } class Zebra extends Mammal { String name = "stripes"; String makeNoise() { return "bray";} } public class Zoo { public static void main (String[] args) { new Zoo().go();} void go() { Mammal m = new Zebra(); …

Member Avatar for rahul.ch
0
151
Member Avatar for ali11

Hi i am looking for following output.I am just getting 0 for a,b,c,d,f. total no of grades Number of A's Number of B Numbers of C Number of D number of F [CODE]import java.util.Scanner; public class ExamScores { public static void main (String[]args) { String a; int count= 0; int …

Member Avatar for Rzink92
0
136
Member Avatar for cgen

I'm finding it difficult to implement an in-place algorithm for bucket sort. The question and my attempt are below. Can anyone give me a hint or an explanation of how I can implement in-place bucket sort? Q: Use the bucket sort idea to sort in-place an array of n records …

0
80
Member Avatar for writeout

Hello forum, I want to write a simple code of two dices rolling for two players. The players can roll as many times as they want per turn. If they are matching numbers, the total is zero. If a person passes, it is passed on to the next player. Please …

Member Avatar for CSloan7597
0
295
Member Avatar for mv740

[CODE]import java.util.Scanner; import java.util.Random; public class test { public static void main(String[] args) { Random rand= new Random(); // being able to use random object int[][] array = new int[3][9]; // print array in rectangular form for (int i=0; i<array.length; i++) { for (int j=0; j<array[i].length; j++) { int k …

Member Avatar for hfx642
0
210
Member Avatar for sidra 100

i have jst started programing in java m beginer. m making gui which contains a two radio button a slider and a text message. although its compiling coreectly but it doesnot display any thing [CODE]import java.awt.*; import javax.swing.*; import java.awt.event.*; public class GUI { JFrame frame; JLabel coord; JRadioButton Man=new …

Member Avatar for hfx642
0
125
Member Avatar for tnimblett

Hi, I don't really have a programming issue rather a artistic issue. Look at the following code of the front view an unfinished building. I'm trying to add a side view to the right or left. I just can wrap my mind on how it is supposed to look. [CODE] …

Member Avatar for tnimblett
0
98
Member Avatar for sidra 100

i m a begginer m making a GUI which consist of a slider and 2 radio button and a text message. i have not added the functionality in it yet. but its not displaying GUI it completes successfuly but at runing time it gives error Exception in thread "main" java.lang.IllegalArgumentException: …

Member Avatar for NormR1
0
92
Member Avatar for KWhite

boolean robotsAlive[]; int robotCount; public int deadRobots (int robotCount, boolean robotsAlive[]) { int deadRobots = 0; boolean robotsALive = true; for( int i = 1; i > robotCount; i++ )//a for loop to loop through the array { //inside the for loop if( robotsALive[] == false ) //and if statment …

Member Avatar for JamesCherrill
0
182
Member Avatar for angeriel1

how can I use JList object in place of JFilechooser show the directory content.any tips or somthing to help me understand this will be apreciated. [CODE]// Display directory content in a JTextArea object. // The user selects a directory via JFileChooser object. import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; …

Member Avatar for JamesCherrill
0
152
Member Avatar for CSloan7597

Hey everyone. I have recently decided to try and learn how to use java Sockets for client/server communication, as well as swing and threads, etc. and have (pretty much) completed a small client server application. The application is basically a syntax-highlighting notepad, a client swing GUI which connects to a …

Member Avatar for CSloan7597
0
291
Member Avatar for mehnihma

Can you help me how to convert this for loop to Enhanced For-Loop? Thanks [CODE] for (int x = 0; x < grade.length; ++x) if (grade[x]==grade1) { gradesum = score [x] * testscore1; }[/CODE]

Member Avatar for masijade
0
141
Member Avatar for elijah11

Hey, Im new to programming and I would like some help , and just to introduce myself to the community, Im looking to learn java, or whatever is recommended for beginners. All the experience i've had is making a Hello world app, some compiling , and etc.

Member Avatar for JamesCherrill
0
38
Member Avatar for xiangzhuang

Hey guys, I have this HW for school for Java but I just can't seem to figure it out. I know I have to use a for loop for it but I just can't seem to figure out everything else. Thanks :D public int factorial(int n) { }

Member Avatar for JamesCherrill
0
423
Member Avatar for techgeek420

I'm working on a program that calculates the day of the week for dates in history or the future. I have the calculation part correctly but there are 4 errors left that I do not know how to fix. Any help will be greatly appreciated! Thanks [CODE]import java.util.Scanner; public class …

Member Avatar for shootingrubber
0
152
Member Avatar for tygergyrl

I am having trouble in sorting out what i need to do for my first assignment. open a text file, with colon char, 1 student number: 2 student name: 3 5 fields with marks; a algorithms: b mathematics: c java: d C++: e scripting open txt file read open txt …

Member Avatar for solomon_13000
0
239
Member Avatar for mohamed moamen

i use speech synthesis javax.speech.synthesis for the first time my program is simple that's say string "hello world" but that not work and give me that Exception: java.lang.NullPointerException at soundreal.HelloWorld.main(HelloWorld.java:20) and i don't know what that mean help plz [CODE] package soundreal; import javax.speech.*; import javax.speech.synthesis.*; import java.util.Locale; public class …

Member Avatar for stultuske
0
103
Member Avatar for ali11

Hi i m creating simple rpn calculator.I m getting following errors. C:\Users\Hamza\Pictures\CalcGUIPanel.java:63: array required, but java.lang.String found cStack.push(buttonOrder[i]); ^ C:\Users\Hamza\Pictures\CalcGUIPanel.java:213: currentValue is already defined in actionPerformed(java.awt.event.ActionEvent) BigInteger currentValue = new BigInteger(cStack.pop()); ^ C:\Users\Hamza\Pictures\CalcGUIPanel.java:215: operator + cannot be applied to java.math.BigInteger,java.math.BigInteger resultValue += currentValue; ^ C:\Users\Hamza\Pictures\CalcGUIPanel.java:223: currentValue is already defined in …

Member Avatar for NormR1
0
265
Member Avatar for vjames

Is it possible to write to an existing text file in a jar. I managed to read from it with getResource() but I am stuck trying to write to it, it gives me a file not found exception. Thanks

Member Avatar for vjames
0
1K
Member Avatar for emmas4impact

I am working on a moving object. so I created a menu bar for size and speed, the idea behind it is that each time small, big or medium is clicked it should change the size and same also applies to the speed but when implement the action listener its …

Member Avatar for emmas4impact
0
206
Member Avatar for rlhh

[CODE] statsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ //Return the string "stats" to gameLoop() as cmd } }); [/CODE] [CODE] public void gameLoop(){ Scanner lineScanner = new Scanner(System.in); cmd = ""; System.out.print(getBoard().printBoard(false)); while (!cmd.equals("quit")) { System.out.print(">"); Scanner wordScanner = new Scanner(lineScanner.nextLine()); if (wordScanner.hasNext()) { cmd = wordScanner.next(); if (cmd.equals("board")) { …

Member Avatar for mKorbel
0
217
Member Avatar for jalpesh_007

I have posted one code. please help me i can't get msg at mouse pointer. please tell me how can i get label at the co-ordinates where the event has taken place. also tell what is the problem with code..it gives output after minimizing and maximizing. hope for reply. Thank …

Member Avatar for mKorbel
-1
206
Member Avatar for xiangzhuang

Complete method called characterCount below so that it returns the number of times the character ch appears in the string s. [CODE] public int characterCount(String s, char ch) { } [/CODE] I know that I have to use a for loop and use s.length() as a stopping point. Other than …

Member Avatar for stultuske
0
136
Member Avatar for chriswinter

I am a begining software engineer in college and have been stumped by a small problem. The assignment is to "encrypt" any text entered. All we have to do is make capitals lower case and vice versa, additionally we have to make a's z's, b's y's and so on. //import …

Member Avatar for hfx642
0
153
Member Avatar for javaNooblet

Hi all, I have a main GUI class as seen here: [CODE] import java.awt.*; import javax.swing.*; import javax.swing.border.*; /* * Class is to communicate with various other classes in the program to * create a roster for user based on their selection on GUI. */ public class MainGUI extends JFrame …

Member Avatar for stevanity
0
261
Member Avatar for pikalife
Member Avatar for sidlampard

hi could anyone tell me how to get bit pattern of a negetive number. For example bit pattern of -1357 is: 11111111111111111111101010110011 and bit pattern of 1357 is: 00000000000000000000010101001101 but how????

Member Avatar for stultuske
0
146
Member Avatar for iXmerof

Hi, I'm making an app that uses Collections. Everything went ok until now, what I've done: I've got a class that initializes 3 strings, those strings are private, so I have made 6 public functions that sets or reads values from those strings. Next I've made a hashmap, keys are …

Member Avatar for iXmerof
0
145
Member Avatar for gopikrish

I am trying to publish my ear and war modules into Oracle weblogic portal 10.3.0.0 server using workshop. I am using pointbase DB. But publishing failed since I was getting the following error, weblogic.application.ModuleException: Exception preparing module: EJBModule(netuix.jar)Unable to deploy EJB: ProxyPagePersistenceManager from netuix.jar: Exception while attempting to deploy Security …

0
76
Member Avatar for pro_learner

Guys,i want a small help from you.I have a created a database in MS Access and now i want to connect it to with Java Application by using ODBC Administartor.But when opens it,it doesn't show any driver for MS Access DBs.Do u guys know any driver for that.I'm using Windows …

Member Avatar for pro_learner
0
199

The End.