32,199 Topics

Member Avatar for
Member Avatar for Forte1292

In high school I learned Pascal and C++. Everything from hello world to search trees, to graphical battleship with AI. Now I'm a freshman in college and in my CS1 class we are using Java, but after 2 months we are just now on arrays. Basically I was just hoping …

Member Avatar for hiddepolen
0
90
Member Avatar for danthevan

Hello, I have a weird problem while running my project. I use netbeans and here's my code and the problem is explained after the code. [CODE]/* * NetworkingView.java */ package networking; import org.jdesktop.application.Action; import org.jdesktop.application.ResourceMap; import org.jdesktop.application.SingleFrameApplication; import org.jdesktop.application.FrameView; import org.jdesktop.application.TaskMonitor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.Icon; import …

Member Avatar for danthevan
0
232
Member Avatar for ilovejava

lets say i have 8 deck of cards how to put all of that inside a array do i have to make a multidimensional array for each deck???

Member Avatar for JamesCherrill
0
269
Member Avatar for xanawa

Hi, I would like to know the code used for java to clear the screen as we do in c# using [COLOR="red"]Console.clear();[/COLOR] is it possible in Java aswell? If yes, what code should i use?

Member Avatar for Taywin
0
144
Member Avatar for ilovejava

hi i started coding battle ship when i was done i noticed that the user and computer always misses, even if they hit, i dont know what i did wrong [CODE]import java.util.Scanner; public class Battleship { public final static String USER = "user"; public final static String COMPUTER ="computer"; public …

Member Avatar for ilovejava
0
2K
Member Avatar for sirlink99

I got this error, when the bullet collides with the enemy. [CODE] 341, 458 null 341, 458 null 341, 458 null 341, 456 java.awt.Rectangle[x=340,y=75,width=50,height=50] 341, 456 java.awt.Rectangle[x=325,y=45,width=50,height=50] 341, 456 java.awt.Rectangle[x=479,y=15,width=50,height=50] 341, 454 java.awt.Rectangle[x=340,y=76,width=50,height=50] <CUT THIS OUT. ABOUT 1000 LINES LIKE THE ONES ABOVE> 305, 352 java.awt.Rectangle[x=222,y=36,width=50,height=50] 305, 352 java.awt.Rectangle[x=299,y=6,width=50,height=50] 341, …

Member Avatar for sirlink99
0
202
Member Avatar for lbgladson

I have the following code to generate an array of random numbers. How can I get it to print the array like [5,89,76,34,2] instead of printing down. I don't think it is actually printing the array just the numbers. [code] import java.util.Random; public class RandomIntArray { private int[] numbers; public …

Member Avatar for lbgladson
0
380
Member Avatar for programing

calculate value of PI from the infinite series π = 4-4/3+4/5-4/7+4/9-4/11 +..... write a class with two data members aproxivalue(double value ) and percision ( integer value ) where precion is the number of terms of the series used to compute the value of approxivalue : 1- default constructor permits …

Member Avatar for Taywin
0
1K
Member Avatar for caswimmer2011

Hey, Is there a way to get the keycode from a char? I tried using KeyEvent.getKeyCode() but the KeyEvent class didn't have a constructor so it was freaking out. I've been searching for 2+ hours already and nothing. My goal is to have a char, convert it to keycode, and …

Member Avatar for caswimmer2011
1
1K
Member Avatar for queendaedra

Hello everyone, I need some help understanding some concepts and possibly with my logic on this problem. We are supposed to create a program that asks users for their name, id, and grade average. The set is supposed to be where the exception is thrown. When the user enters their …

Member Avatar for Zaad
0
391
Member Avatar for soham.m17

I'm using ArrayList. But the problem is that the indexOf function is not working in a for loop. It's showing 0 for all the elements or objects. Code goes like that for a FOR loop : [CODE]for(or_data or : counts.or_gates) { if (or.isHit(x, y)) { mutual=counts.or_gates.indexOf(or); set_move_cursor(); or.addX(dx); or.addY(dy); System.out.println("Got …

Member Avatar for soham.m17
0
219
Member Avatar for queendaedra

Here is the assignment criteria : Implement exception handling to validate user input as was described in class. You need to at least catch type mismatch exception. No late or by emailed homework will be accepted. We are to have a student enter their name, id and grade. The name …

Member Avatar for JamesCherrill
0
152
Member Avatar for cisumma

Hello I was working through a Netbeans tutorial : [URL="http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/"]http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/[/URL] I am having a problem understanding adding my properties and xml dependencies contained in an xml dir in my project (Please find screen print of dir) I jar my app and it can not find these files or dir. java …

0
124
Member Avatar for soham.m17

I am building a Circuit Editor using Java. I'm now at very first stage. Now I'm building a simple editor like Paint. I've implemented a drawing-pad where you can draw straight line and continue the line until you click an right click, by a "WIRE" Button click in the frame. …

Member Avatar for soham.m17
0
4K
Member Avatar for Dwillich87

I'm having to design a program in java to get the radius from the user than print back the diameter, circumference and area using that radius I'm not sure where I'm going wrong in this [CODE] import java.util.Scanner; public class Circle { private static void circleInfo() { float radius; public …

Member Avatar for JamesCherrill
0
125
Member Avatar for havoc433
Member Avatar for havoc433
0
162
Member Avatar for CKShia

I am doing a project like a car gallery system and need to ask for help... Suppose I want to create a class call [COLOR="Red"]"Brand"[/COLOR], it is basically just to store the brand name, a brief description, and also need to give it a picture. Says: Toyota, it is a …

Member Avatar for JamesCherrill
0
2K
Member Avatar for nickliutw

I'm running to compiler error while I'm trying to use Enum to create a program that display a deck of cards. The compiler mistake is "Cannot find symbol", but I did call the constructor and use method call to call the method in card class. It still give me compiler …

Member Avatar for ~s.o.s~
0
204
Member Avatar for peck3277

Hey guys, I'm bit of a noob so please bear with me. I'm trying to open a lot of urls in internet explorer at once. About 40 urls. I have an array of my urls and I'm using the following code: [CODE] for (int i = 0; i < urls.length; …

Member Avatar for peter_budo
0
221
Member Avatar for Jessurider

can anyone tell me how to [B][U]setOwner[/U][/B] as well as the [B][U]fileKey[/U][/B] for the particular file........ i've retrieved the metadata information but can't able to set values..... [CODE="java"] import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.AclFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.UserPrincipal; /** * * @author user */ public class …

Member Avatar for Jessurider
0
240
Member Avatar for Syrne

Hey guys. I am getting a fair amount of errors when trying to create this menu. I am not sure whether or not I am going about it correctly. Without further adieu: [CODE]package assignment.pkg2; import java.util.Scanner; public class Assignment2 { public static final int MAX_NUM = 10; public static void …

Member Avatar for Taywin
0
151
Member Avatar for lbgladson

I have an assignment to reverse the sequence of coins in a purse. I cannot use any methods from the Collections or Arrays Class. I have the following code but have no idea what to do from here to get the purse contents to reverse. [code] import java.util.ArrayList; public class …

Member Avatar for Taywin
0
167
Member Avatar for lbgladson

I have an assignment to create a class Purse and print the coins in the purse, reverse the sequence of the coins, transfer the contents of one purse to another, and compare to see if two purses have the same contents. I have the following code but the transfer is …

Member Avatar for Taywin
0
249
Member Avatar for shawntheking

So I have to create a guessing game to be played between 2-5 players. That part wasn't very difficult. I am however having LOTS of trouble with the try...catch statement. I have to have to make the program have a try catch so it doesn't throw an error if the …

Member Avatar for Taywin
0
1K
Member Avatar for I<LateNupurGuha

[INDENT]:icon_lol:Suppose there is a (method) [U]call stack[/U]; An [B]exception[/B] has occured in a deep level but not handled there yet; So the corresponding [I]finally block[/I] at that level is executed first and then [B]it[/B] is thrown to be propagated up through the [U]call stack[/U] and at each step if [B]it[/B] …

Member Avatar for I<LateNupurGuha
0
115
Member Avatar for gahhon

[CODE] public class Planet { private String planetName; private int travelDay; public Planet(){ planetName = "Earth"; travelDay = 365; } public Planet(String planetName, int travelDay){ this.planetName = planetName; this.travelDay = travelDay; } public void setPlanetName(String planetName){ this.planetName = planetName; } public String getPlanetName(){ return planetName; } public void setTravelDay(int travelDay){ …

Member Avatar for gahhon
0
128
Member Avatar for I<LateNupurGuha

[INDENT];)Suppose a method is called with [COLOR="Red"][B][I]formal[/I][/B][/COLOR] parameters of [COLOR="Red"]supertype[/COLOR] and [COLOR="Red"][B](1)[/B][/COLOR]the [COLOR="Red"][B][I]actual[/I][/B][/COLOR] parameters of [COLOR="Red"]subtype[/COLOR]; Now the method declaration is [COLOR="Red"][B](2)[/B][/COLOR]overridden and overloaded in the [COLOR="Red"][B](3)[/B][/COLOR]previous same [COLOR="Green"]class[/COLOR] as well as in the [COLOR="Red"][B](4)[/B][/COLOR]overriding [COLOR="Green"]subclass[/COLOR]. :icon_rolleyes:An [COLOR="Green"][B]object[/B] [I]reference[/I][/COLOR] is used on which the call is performed; Here the [I][COLOR="Green"]reference[/COLOR][/I] …

Member Avatar for peter_budo
-1
60
Member Avatar for i2u2me

Why do you think the Java language chooses to treat file data as a stream rather than as a single object?

Member Avatar for i2u2me
0
73
Member Avatar for luky279

HI, Iam trying to develop SMS Application by using java communicaition API. iam getting error msg like com.sms.samples.SerialConnectionException: Port currently owned by SMSConnector Iam aware that by using modem we can develop an application. But how to develop with out using modem.what are the requirements required. plz help me ..... …

0
56
Member Avatar for xaelophorus

Hello all! I'm helping my employer redesign their database system. They're currently using MS Access exclusively, but they are updating their computer systems to Apple machines and want to convert to a standalone application to access a background database (e.g., a standalone Java program using JDBC to access a background …

Member Avatar for ~s.o.s~
0
188

The End.