32,204 Topics
| |
| |
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 … | |
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" … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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" … | |
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 | |
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 … | |
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 … | |
Hi guys I try to run this shell in java but it never works. Process p = Runtime.getRuntime().exec(" cat *.java|sed '/import/d'|sed'/package/d'>>b.java "); when I change the cmd to something like "ls" or "open foo.java" the code will works. Any idea why? | |
Ok, so here I have a program that creates two boxes. The top box should start out with all 12 months of the year in it. What I'm trying to have happen is be able to move the months (through the two buttons) back and forth. Originally it just had … | |
Hi there, I'm just starting with Java and Desktop programming but I have some doubts, for example: You are going to write a new application, you go there, draw your ER for your database, UML, etc. My problems is when I need to integrate the interface with the program logic, … | |
I need help converting my code into an ArrayList. We are only supposed to use an ArrayList and not an array. I didn't see that part of my project and not too good with using ArrayList. Please help me figure this out. public class Transcript { private Course[] courses = … | |
Hi All, Im working on a program for school which combines 3 programs together(one transposes a 2d array, one adds up the diagonals and tells them, and one adds the rows). The problem Im having, is with importing all the data into the 2 Dimensional array "input" so it can … | |
Anyone know of a way to run multiple clients on netbeans for a java program, i need to test my server which takes in x amount of clients. Currently i can only run 1 client with my computers hostname and the server but cannot test if the server will work … | |
i just finished one game in java using JApplet. is there a way for me to use a database so i can keep track of scores? I am using xampp control apache for my website database to keep track of username etc.... in php. Can i connect to it using … | |
Hello Sometimes I update my web service JAR by deleting the old one (waiting for the undeploy message to appear on the console) and putting the new one (and seeing the deploy message) and when I call it, it gives a heap size error. I have to restart the PC … | |
public class review{ //method code public void start() { int a, b; a = 5; b = methodA(a); System.out.println(a + " " + b); } private int methodA(int a) { int b = 10; a = a + 5; return a + b; } //method end } ------------------------------------------------ i compile … | |
Hi all it's that time again, java exercise! Mindful of what happened last time http://www.daniweb.com/software-development/java/threads/449525/building-a-simple-airline-reservation-system-exercise/ , this time I have decided that I want to have all the pseudocode done before I even start thinking about how to code the whole thing. This is what the exercise requires: > Create … | |
Hello people. I need an explanation about inheritance I got a little confused in class: This is the modelling problem: There are two objects: doctors and patients. They are expected to have only the following attributes: Doctors have: name, age, id, and salary Patients have: name, age, id, and disease … | |
i have this code to render a locally saved html file onto a jframe. i have the following problems with how the html was rendered: 1. the texts of the 'webpage' do not wrap; 2. in order to solve my problem in 1. above, i added a JScrollPane, problem is, … | |
Hi, I am reading this book to learn about web services. How do I compile the exercise given in chapter 1. Appreciate a reply. in cmd do i go to eac directory and compile and execute the code. Really appreciate a reply thanks | |
**Task:** "pass these four variables (x,y,w,h) into the getSubimage method of the original_image object." That method returns a BufferedImage, which i need to directly return from my getImageRect method. I have not included my whole code, but i was wondering if anybody could help me out with this? If you … | |
import java.text.SimpleDateFormat; import java.util.Date; public class StringtoDate { public static void main (String args[]){ String inputDate = "04.11.2013 11:14:45 GMT 00:00"; Date dat = convertStringToDate(inputDate); } public static Date convertStringToDate(String inDate){ SimpleDateFormat sdf = new SimpleDateFormat("mm.dd.yyyy hh24:mm:ss"); Date date = new Date(); try { date = sdf.parse(inDate); } catch (Exception … | |
How to implement GUI to my code? I know how to make the buttons and etc i just dont know how to "connect them together" thanks `import java.util.Scanner; public class Pizza { public static void main(String[] args) { Scanner inScan = new Scanner(System.in); int choice, choiceEnd, howMany, pizzaNumber; double totalCost, … |
The End.