35,618 Topics

Member Avatar for
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
203
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
386
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
393
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
221
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
155
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
126
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
126
Member Avatar for havoc433
Member Avatar for havoc433
0
165
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
222
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
241
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
153
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
170
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
252
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
117
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
130
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
61
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
75
Member Avatar for teddy_kul

[CODE]<% String Username = request.getParameter("USER_ID"); String Password = request.getParameter("USER_PASS"); String Mobile = request.getParameter("Mobile"); String Address = request.getParameter("Address"); String sql = ""; { int LoaiSubmit; String DriverName; String connectionURL; Connection con; Statement stmt; LoaiSubmit = 0; LoaiSubmit = Integer.parseInt(request.getParameter("LoaiSubmit")); DriverName = "oracle.jdbc.driver.OracleDriver"; connectionURL = "jdbc:oracle:thin:@"; con = null; stmt = null; …

Member Avatar for peter_budo
0
146
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
57
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
189
Member Avatar for hhheng

I'm new to Java and while trying to add a text area to the applet, found the textarea uneditable, and while trying to add the scrollbar to the textarea, found the applet will not be started. Code as below: [code=java] import java.awt.*; import javax.swing.*; import java.applet.Applet; public class AppletEditor extends …

Member Avatar for hiddepolen
0
413
Member Avatar for kiranShankar

sir -- i wrote in the jsp for remving junk character from the application [code]<% request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); %>[/code] but still some page show the junk character what should i doo...

0
64
Member Avatar for yuca89

Hello! I am writing a simple java application which executes another command with "sudo" (on Ubuntu). My application works properly when i start it with "sudo my_java_application". But if i start it without sudo it does not works. And it does not ask me for password. It gives error when …

Member Avatar for yuca89
0
82

The End.