32,204 Topics
| |
[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){ … | |
[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] … | |
Why do you think the Java language chooses to treat file data as a stream rather than as a single object? | |
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 ..... … | |
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 … | |
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 … | |
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... | |
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 … | |
Imagine a windows paint program that draws a square. I wrote some code to do the following: A vertex change may make a square bigger or smaller (or unchanged if the vertex value is the same). You must adjust the other vertices, as necessary, to keep the shape a square. … | |
Hello, I'm currently working on a small database project with various search algorithms. Right now I seem to be a little stumped. Basically what I need to is to read a huge file of strings, such as these 2 lines: Abram,Smith,70,M,Nursing Unit,324b Ace,Lewis,7,M,Intensive Care Unit,324c I then need to delimit … | |
Good evening im seeking help with this program, it is in a loop that ends if a negative number is entered, I am trying to get the largest number entered in the do while loop, ive tried creating a temporal variable (temp), but I dont know where to go from … | |
Hi, I am a beginner so bear with me. I have an assignment in which I have to create an array with numbers and then have a loop with condition to check in which order the user has inputed the numbers. Asc=1, desc=-1, other=0. This loop isn't working, i know … | |
write a java program that prompts the user to input and integer and then ouputs both the individual digits of the number and the sum of the digits. This is what I have but it is not working when I input a negative number. Why? Need help! import java.util.*; public … | |
Alright so I have to Save and Load an array, and I am unfortunately running into issues at saving, where it keeps giving me the error[QUOTE]Exception in thread "main" java.lang.NullPointerException at java.io.FileOutputStream.<init>(FileOutputStream.java:186) at java.io.FileOutputStream.<init>(FileOutputStream.java:84) at SocialEventList.saveAppointmentData(SocialEventList.java:41) at Test.main(Test.java:120)[/QUOTE] [CODE]import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; public class SocialEventList { private SocialEvent[] … | |
What is the usage of JTabbedPane and JPanel and which case we are using the components... Thanks | |
I need some idea how to correct this program. Though I think I understand the concept, my implementation is wrong. My program only prints the orignal string and does nothing with it. [CODE] public class ArrayStack<E> implements Stack<E> { protected int capacity; protected static final int CAPACITY = 1000; protected … | |
Hi all, I did some basic method overloading program, when I run the bellow program i got output as int long but expected is short long.. can Any one explain me My code is : [CODE]public class MyClass { public static void disp(Long n) { System.out.println("Long "); } public static … | |
I am trying to get the program to print how many of each letter of the alphabet is in the bible but it is throwing and error. I am just using a small part of the bible until I get it to run properly. Please help. import java.io.File; import java.io.FileNotFoundException; … | |
| The last do..while loop only prints the 2^n of the number entered and n is user input. It does not print all 2^n from 1 to what ever value user inputted. [CODE]/** * * * @author * @version */ //import Scanner utility import java.util.Scanner; public class Loops { public static … |
The problem I am trying to solve is Write a program using fork() to compute average of N numbers. The parent process forks a child process that takes input from the user, adds all the numbers and returns the sum and the count of numbers to the parent process that … | |
I am trying to make a Fibonacci sequence program to display up to the nth term(only positive numbers). For some reason it doesn't seem to work. [CODE]import java.util.Scanner; /** * * @author Toby */ public class Fabonnacci { /** * @param args the command line arguments */ public static void … | |
Dear Daniwebbers, I have a problem regarding the calling of methods on a protected parent object from within a child object, the protected parent object being a child object of the same class. I have a class HostileArea, wich has a "protected DungeonRoom[][] dungeon", DungeonRoom being a child of HostileArea. … | |
hey Guys, im creating a clas that is to be used in a HashMap to map phone numbers to name. for example : map.put( new PhoneNumber(207, 8269600, 260), “Paul”); [CODE] public final class PhoneNumber { private final int areaCode; private final int number; private final int extension; public PhoneNumber(int areaCode, … | |
I know this is easy but I think some people out there are interested in my idea about storing user input in an array...... i read it some where and thought about bringing it much closer to you. [code]import java.util.Scanner; /** * * @author BUSKER-OTT */ public class USERINPUT { … | |
[code] import java.util.*; import java.text.*; public class FactorialApp { public static void main(String[] args) { // create a Scanner object named sc and intializ variables Scanner sc = new Scanner(System.in); // perform Factorial application when user enters "y" or "Y" String choice = "y"; while (choice.equalsIgnoreCase("y")) { //get input from … | |
Hello, im sort of an intermediate programmer that has never installed a library on java before could anyone please tell me how to install this library on java so I could use the charts functionality, Please there are all sorts of folders in there I really dont know what to … | |
The program already can compile and run. But, when we enter the film's code, an error will occurred. We had no idea how to solve it :\ [CODE] public class Entity { private String itemCode; private String title; private String description; private int language; private int time; private String productCompany; … | |
| I have my program all working but whenever a user clicks cancel or exit I want the program to close, not throw my catch. Whenever a user throws a catch they have to input their answer twice before it will go back to normal operations. [CODE] import java.util.*; import javax.swing.*; … |
Hello forum, vaironl here. I would like to notify you all that I'm in an IB- Computer Science class (I'm learning a lot as I go, since I promise to skip the normal CS course). I would like to know if I could design this frame for my final project, … | |
am writing a program that plays rock paper scissor. The user will enter choice manually (rock is1, paper is 2, and scissors is 3) and the computer will chose one at random without letting the user know. The game will run as many times as the player wants. I can … |
The End.