35,618 Topics

Member Avatar for
Member Avatar for peymankop

Hi...! i wan to write a program that when i give it a number and a string it replace string with length=number to "1,2...,n" but its replace part doesn't work! this is the code: package fasle5; import java.util.Scanner; public class Tamrine8 { public static void main(String args[]){ System.out.println("Enter N:"); Scanner …

Member Avatar for JamesCherrill
0
201
Member Avatar for moha_1990

hey guys this is the question compile shuffleUniqueRandomNumbers.c and run the exe file to generate n number of random numbers. The program asks for three (3) parameters: generated number, lower bound and output file name. For example if you input 100 as generated number, the program will generate 100 numbers …

Member Avatar for jwenting
0
235
Member Avatar for codys21

I am getting an error when I run my program that says: Exception in thread "main" java.lang.NullPointerException at defaultpackage.GradeBook.setName(GradeBook.java:25) at defaultpackage.GradeBookDemo.readFromFile(GradeBookDemo.java:52) at defaultpackage.GradeBookDemo.main(GradeBookDemo.java:23) I've looked through my program and cannot figure out what is actually wrong. The first class is GradeBook and the second is GradeBookDemo. I have to use …

Member Avatar for bguild
0
499
Member Avatar for Translucentbill

How would I make an Image work like a button? I need it for a yahtzee game. I want it so that after i roll the die and the image is displayed i want to be able to select the die i wish to keep and then re-roll the ones …

Member Avatar for goodtaste
0
1K
Member Avatar for Violet_82

Hi, when I started to look into programming, one of the things I remember many programmers are quite keen on are setters and getters. I totally understand the importance of them but there is one thing that isn't really clear to me. If I have a class with some private …

Member Avatar for Violet_82
0
173
Member Avatar for Violet_82

Chaps, I am having some problems with a return statement in a function. I have this situation: public boolean isFine(){ for( int i = 0; i < myarray.length; i++ ){ for(int j = 0; j < myarray[i].length; j++ ){ if( myarray[i][j] == myEnumeration.FRIDAY ){ return false; } else{ return true; …

Member Avatar for Violet_82
0
170
Member Avatar for jared.j.roberts.7

Hiya, I am new to java, I have a very fast paced class and I am learning as much as I can as quickly as I can. I have previous experince with C++ but it will not help here. My Question: **WHY WILL MY PROGRAM NOT RUN!!??** *It compiles and …

Member Avatar for radhakrishna.p
0
187
Member Avatar for Violet_82

Chaps, sorry I have a silly question. I am not quite sure if this is right, but what is the differenct between the two below: public class myclass{ public static void main( String args[] ){ boolean variable1 = false; boolean variable2 = false; ... System.out.print(variable1 + " and " + …

Member Avatar for Violet_82
0
181
Member Avatar for joseph.lyons.754

Hey Guys, I am working on a search that takes in a value via textfield. Once taken in it should display another Jframe with the info but the searchbox crashes the second I run it. Its some stupid mistake I have made or i have gone about it the wrong …

Member Avatar for JamesCherrill
0
378
Member Avatar for sainaleni.guttula

`**when we write a program in java main() will be executed first why?**`

Member Avatar for stultuske
0
94
Member Avatar for newGains

i created a testScores class which initialized an object with an array of scores and had an exception that if the score was <0 or >100 it would throw an IllegalArguementException. I got my main program to work it throws the exception for the array with the bad grade in …

Member Avatar for JamesCherrill
0
302
Member Avatar for JustLeftRavenholm

/** Saadman's ISU **/ import java.io.*; import java.util.*; public class ISU { public static void main (String[]args) { //Keyboard Initialization Scanner kbin = new Scanner(System.in); //Variable Inititialization & Declaration; String list[] = new String [21]; int price1 = 30; int price2 = 20; int price3 = 25; int price4 = …

Member Avatar for stultuske
0
219
Member Avatar for ganges

Hi, help me to configure (hibernate + mysql + xml) in eclipse, I am getting errors while following the sites when i got them in google seach thanks for your time

Member Avatar for <M/>
0
81
Member Avatar for tingwong

Hi I am working on a project on writing our own huffman coding. I am currently having trouble writing the binary 1's and 0's to an output file. It works with smaller input files but for very large files it does not write anything out to the output file. The …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for game06

i am trying to make a breakout game where you have a paddle and ball bounces around breaking bricks. the problem is that if ball touches the corner of player(cyan paddle). than it goes inside of player. i could not understand why. only thing it might be bc of all …

Member Avatar for JamesCherrill
0
114
Member Avatar for Sanjeev_2
Member Avatar for markchua89

package Assignments5; import java.util.*; public class Question5 { public static void main(String[] args) { int[] intArray = new int[8]; int searchValue = 0, index; System.out.println("Enter 8 numbers : "); Scanner input = new Scanner(System.in); for (int i = 0; i < intArray.length; i++) { intArray[i] = input.nextInt(); } System.out.print("Enter a …

Member Avatar for stultuske
-1
130
Member Avatar for markchua89

package Assignments1; import java.util.Scanner; public class Q5 { public static void main(String[] args) { { int size; Scanner reader = new Scanner(System.in); System.out.println("Enter the size :"); size = reader.nextInt(); int [] grades = new int [size]; int sum = 0; double average; for(int i=0; i<grades.length; i++) { System.out.println("Enter the grades" …

Member Avatar for markchua89
0
215
Member Avatar for Forte1292

I have the numbers 0-8 so I can represent a state as 012345678 012345687 .... 876543201 876543210 This gives me 40320 ways to represent a state so I have a HashMap of size 40320 and I need a good way to make sure each state only corresponds to 1 key …

Member Avatar for bguild
0
151
Member Avatar for StefanRafa0

i have question how do i can write math in java im confuzed by pithagoric theoromy, limes, geometry etc someone show me some exsample im realy interested how that can be made :) Thanks xD

Member Avatar for JamesCherrill
0
193
Member Avatar for ganges

Hi, I try to perfom basic CURD operations in hibernate "org.hibernate.InvalidMappingException" this is the error i am getting help me to fix it. i am using eclipse indigo, mysql lib jar files are: ------------------ hibernate 3.jar, asm.jar,cglib - 2.1.jar, commons-logging - 1.0.4.jar, commons-collections-2.1.1.jar, dom4j-1.6.jar, ehcache-1.1.jar, jta.jar, log4j-1.2.9.jar, mysql-connector-java-5.0.8-bin.jar Employee.java package …

Member Avatar for ganges
0
2K
Member Avatar for sliobra

I was doing my assignment till I reached this point. Add a static Date toDate(String str) method to the DateTest class. If the method is called with a string like “23/5/2013”, it will create and return the corresponding date object. If the input string is not valid date, the method …

Member Avatar for JamesCherrill
0
205
Member Avatar for l.worboyz

I have been looking over past exam papers for revision for an upcoming uni exam for Java and one of the questions was, asking for code to add to a given abacus program to make the grid display 3 counters in each column of a 10x6. e.g. as soon as …

Member Avatar for JamesCherrill
0
217
Member Avatar for bhallarahul

hello I want to know to how to make class singleton but donot make constructor private and method static. means want to something which is not possible to clone. Something like that Thanks Regards Rahul

Member Avatar for JamesCherrill
0
185
Member Avatar for trishtren

Hello, I was hoping someone can help me, im looking for a way to extend a basic shape class in particular the roundedrectangle2d class and be able to draw it in the same way we could handle an object with a simple call to g.draw(object instance); However im having problems …

Member Avatar for JamesCherrill
0
381
Member Avatar for jmw5598

Hey, I've come across an error in my school project. I'm creating a college registration web app. The jsp displays a list of available classes with checkboxes to check the ones you would like to register for. I've been running it in debug mode and it throws an exception at …

Member Avatar for radhakrishna.p
0
132
Member Avatar for game06

i am trying to put a java japplet on website. when i run in eclipse it works fine but when i run on website then i get a error: error: on website CacheEntry[http://localhost/eCommerce/menu_pages/game_pages/java_game_3/Main.class]: updateAvailable=true,lastModified=Fri Apr 26 20:39:42 EDT 2013,length=10508 CacheEntry[http://localhost/eCommerce/menu_pages/game_pages/java_game_3/Main$Display.class]: updateAvailable=true,lastModified=Fri Apr 26 20:39:42 EDT 2013,length=2489 Exception in thread "AWT-EventQueue-2" …

0
97
Member Avatar for woolf

Hi, I am trying to write a java program for a client server instant messaging system using UPD datagram. I am trying to think of how to start. Anyone has any suggestions? Please advise

Member Avatar for peter_budo
0
803
Member Avatar for game06

making a scrolling background. There is one problems with this code below. I am drawing a image and it stay there on left of screen. i want to del it and create new one so there aren't 100's of background images on left. i just want to keep 2 background …

Member Avatar for game06
0
185
Member Avatar for peymankop

Hi...! i'm working on a notepad project but i've got a problem in undo action this is my code: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import java.io.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.JLabel; import javax.swing.SwingConstants; import javax.swing.undo.*; public class Notepad …

Member Avatar for stultuske
0
382

The End.