32,204 Topics
| |
why the do-while couldnt return the main body when i did once.when I input n<2 and press enter, it stops and turns to error. i dont know why?could i any one told me why and how to change it and is there another code to do this loop( instead do-while).thanks … | |
[code] import java.util.*; public class course { static Scanner sc=new Scanner(System.in); public static void main(String[]args) { String name,students,addStudent; int numberOfStudents; String courseName,getName,getStudents; int getnumberOfStudents; Course course1=new Course("C++"); Course course2=new Course("Java"); course1.addStudent("Peter"); course1.addStudent("Brian"); course1.addStudent("Anne"); course2.addStudent("Peter"); course1.addStudent("Steve"); System.out.println("Num of student in course1:"+course1.getnumberOfStudents()); String[]students=course1.getStudents(); for (int i = 0; i < course1.getNumberOfStudents(); i++) … | |
HI ! GUYS WILL YOU PLEASE HELP ME IN SOLVIG A SIMPLE QUESTION RELATING TO JAVA RMI MY QUESTION IS HOW TO START RMI REGISTRY PROGRAMATICALY with out TYPING IN CMD(command prompt ) start rmiregistry ? | |
i dont know where to put my getValidString validation when i ask the user if he wants to judge another public class JudgingApp { public static void main(String args[]) { Scanner sc= new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.##");//format decimals to 2 decimal places //These variables hold the max and … | |
When the program calls the getValidString it won't display "Judge Another? (y/n)" It seems like everything should work I just can't figure it out //see if the user would like to continue choice = getValidString(sc,"Judge Another? (y/n): ", "y" , "n" ); private static String getValidString(Scanner sc, String prompt, String … | |
Hello all, I am writing a program that implements a parser for the grammar. One of the methods I created is a boolean method which returns true or false depending on if a character is an expression. The compiler is saying "this method must return a result of type boolean" … | |
I have no idea how to fix the compile warning. Y:\Development\Java\Mileage\Mileage\src\my\Mileage\MileageUI.java:296: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector dataList.add(doctorData); Appreciate some suggestions. Thanks.. | |
Hello all, I am writing a program for a class that implements a parser for a given grammar. I have already successfully written it in c++ and now I have to also write it in java. The string to be parsed is a string array in my program and when … | |
Hey, so I need to write an algorithm that will do the following and run in O(n): Search linearly through an array of size n and for each element check whether array[i]>array[i-k] for all k=1,2,...n/5. Its easy to do this with two loops but I cant figure out how to … | |
Unfortunately, I couldn't find a suitable thread already so please forgive me if there is one already... but! This was a project due today which I just bit the bullet and left out one part of. Here is my problem: I am building a circular doubly linked list with a … | |
1. Create a class Account that has following instance variables: a. private account number (string) b. private account holder name (string) c. private balance (floating-point) d. private account opening date (string) e. profitRate (final, floating-point): 5% for all accounts Supply a default constructor, a parameterized constructor, and a clone constructor. … | |
Hello all I am trying to get a JButton to toggle the setVisible on a JPanel label with an image on it. Below is my code. Thx in advance! [CODE] import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class ButtonExample_Extended implements ActionListener { JPanel titlePanel, buttonPanel, dealerPanel, playerPanel; JLabel dealerLabel, playerLabel, … | |
Hi, I am fairly new to java and have been playing around with scanners and while trying to understand this problem I am running into an error "Non-static variable vacation cannot be referenced from a static context" Obviously this isn't quite a completed program, but I am not sure why … | |
hi, i,m newbe to hibernate. can any one explains how to do bi- directional associations in hibernate . cheers... udayanga | |
Hello all, I have used this code throughout this application with no troubles. I am creating a datatable, and the data is a result set returned from a sql query to an oracle 11g database. I'm creating a TableModel class that overrides the AbstractTableModel so I can add fetures to … | |
Hi. I really need help. I´ve written a program in java that connects to an ftp-server and changes files. as it is now i have a JPanel and i have to press a button and write the name of the file but i want the program to do this automatically … | |
I'm new to java.I write the code and dont know why its wrong.Someone can point out and modify it for me.thanks alot. Here the code[CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package OOP; import java.util.Arrays; import java.util.Scanner; /** … | |
Hi, how do u calculate the sum of the numbers in the array? Thanks! | |
Hi, Is it possible that, the Iteration of normal bean (not a Form bean) values contained in a vector into a jsp page.? please help me | |
Guys.. I am trying to figure out Comparator so I can compare Strings in an object array (the object has other data types as well). I have been hunting around and have come up with this.. but I cant get it to work --> Can anyone point me in the … | |
Hello. I'm currently have a task to make but i can't complete it because of my weak knowledge. I need to draw half of sin parabola with straight lines . Like this [url]http://www.mif.vu.lt/matinf/asm/vs/pask/java_pr/uzd/7.jpg[/url] It gives me a headache because i really don't like JAVA (I think it's not for me) … | |
I want to create a method equals(Object obj) to test if two objects are equal. But I don't even know how to start. Here is my program [code] class LinkedList { ListItem front = null; ListItem rear = null; int numItems = 0; // Current number of items. // Could … | |
i am using scanner class, i faced problem when i tried to get a string with space. How can i modify my code to solve the problem. Here is my code: [CODE] import java.util.Scanner; class abc { public void main(String[] args) { Scanner abc = new Scanner(System.in); System.out.print("Name: "); String … | |
I wrote up a CombatHandler class. Here is what the begining: [CODE]public class CombatHandler extends client {[/CODE] But when I compile I get this error: [CODE]Running Compiler -------------------------------------- CombatHandler.java:3: cannot find symbol symbol : constructor client() location: class client public class CombatHandler extends client { ^ Note: stream.java uses or … | |
I am trying to get this program to count the number of characters in a string. By number of characters l mean not punctuation or a space.What is wrong with my code because l don't understand why the program won't work? [CODE]import javax.swing.*; publiemc class ExamPractise { public static void … | |
I need to create a scientific calculator using applet in neat beans 6.1 but i cant do it. if there someone who did it before, can you help me about my problem.its for our project in our school. asking a help.Thanks a lot. | |
Hello... This is my last assignment from my Data Structures class. I turned it in and got a good grade, but it still has one problem that I am unable to pinpoint. The assignment is as follows: Create an alphabetical linked list from a .txt file containing various names. (1 … | |
I have several classes that I use in almost every one of my projects. [B]What[/B], and [B]How[/B], do I create something so the I can easily access them? I'm use NetBeans for my IDE. Thanks.. | |
This is my now finished code: [CODE]// ********************************************************** // Count.java // // This program reads in strings (phrases) and counts the // number of blank characters and certain other letters // in the phrase and quits upon the user entering the phrase "quit". // Modified by: Chad Watkins // ********************************************************** … |
The End.