I don't know what's wrong with my code. it's about class and object.
* This is generic type of Person
package myManagement;
* @author roadorange
public class Person {
private String SS;
private String firstName;
private String lastName;
private String middleName;
private String phoneNumber;
private String address;
private String birthDay;
public void setSS (String SS) {
this.SS = SS;
public String getSS() {
return SS;
public void setFirstName (String firstName) {
this.firstName = firstName;
public String getFirstName() {
return firstName;
public void setLastName (String lastName) {
this.lastName = lastName;
public String getLastName() {
return firstName;
public void setMiddleName (String middleName) {
this.middleName = middleName;
public String getMiddleName() {
return middleName;
public void setPhoneNumber (String phoneNumber) {
this.phoneNumber = phoneNumber;
public String getPhoneNumber() {
return phoneNumber;
public void setAddress (String address) {
this.address = address;
public String getAddress() {
return address;
public void setBirthDay (String birthDay) {
this.birthDay = birthDay;
public String getBirthDay() {
return birthDay;
public void Person() {
SS = "1234567890";
this.firstName = "abc"; //test the keyword "this"
this.lastName = "xyz";
middleName = "na";
phoneNumber = "123456789";
address = "11-11 22st dreamcity ny 11111";
birthDay = "11-11-1980";
public void print() {
System.out.println("Display Database\n"
+ "Social Security Number: *********" + "\n"
+ "First Name: " + getFirstName() + "\n"
+ "Middle Name: " + getMiddleName() + "\n"
+ "Last Name: " + getLastName() + "\n"
+ "Phone Number: " + getPhoneNumber() + "\n"
+ "Address: " + getAddress() + "\n"
+ "getBirthDay: " + getBirthDay() );
package myManagement;
//this class is used to test other class or test other object
public class testClass extends Person{
public static void main(String[] args) {
Person obj1 = new Person();
obj1.print();
System.out.println(obj1.getFirstName()); //test the object
Result:
Display Database
Social Security Number: *********
First Name: null
Middle Name: null
Last Name: null
Phone Number: null
Address: null
getBirthDay: null
null
i don't know why it's all null. i assign something in the default constructor. it shouldn't be "null".
does anyone know why?
when you create 2 class using netbean editor, person.java and test.java
i never compile person.java.
when i finish typing these 2 class and i just right click test.java and run.
my question is do i need to compile person.java before i run test.java directly??
does Netbean compile it automatically when i run test.java first time?
i add another constructor Person constuctor with one parameter in Person.java and create 2nd object to test the 2nd constuctor and run.
All the codes work, so does the first default constructor. i don't why is that.
Then i removed what i added and restore back to where it didn't work before and test again. it works.
@_@. so weird.
problem solved. thank you
Edited by: roadorange on Feb 25, 2008 7:43 PM
Similar Messages
-
I don't know what's wrong with my camara it's all black and the front only works not the back
I don't know what's wrong with my camara it's all black and the front only works not the back
Try This...
Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
Reset ( No Data will be Lost )
Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
Wait for the Apple logo to Appear...
Usually takes about 15 - 20 Seconds... ( But can take Longer...)
Release the Buttons... -
Hi my itunes library is constantly disappearing, I really don't know what is wrong. It keep happening everytime I turn my laptop off, I thought I had solved the problem the other week however it has started back up again. I have a Sony Vaio laptop and have read on the discussions that this can occur but all the solutions I have read haven't seemed to solve it. Anybody else got an idea? I would be really grateful for the help!
See this post. Seems that AVG is the most likely cause. They are promising a patch tomorrow.
tt2 -
I don't know what's wrong with my 3GS. It only shows the black screen with white apple. Home button and turning the phone off then on doesn't seem to do anything.
Thanks Lucas,
I've tried doing that with no results. Same screen keeps showing. Maybe it'd be more helpful if I told you a bit more info. My phone was randomly playing music, and the voice control would also suddenly start without me touching the phone. Then I let the battery die and started to recharge when on the screen it indicated to plug into my computer/iTunes, I tried to restore but was getting an error message (can't remember what it said now). Battery died and now my current issue of the black screen with white apple. I'd love to be able to restore my phone but now its not showing as a device on my iTunes. HELP! Any other suggestions? -
[b]Does anybody know what is wrong with my code[/b]
I cannot see what is wrong with this code but i can't get it to compile. when i try to compile it i get the
"Exception in thread "main" java.lang.NoClassDefFoundError:
Is this a problem with compiling or is it a code error?
Here is my code
public class IntCalc{
int value;
public IntCalc(){
value = 0;
public void add(int number) {
value = value + number;
public void subtract(int number){
value = value - number;
public int getValue() {
return value;
Message was edited by:
SHIFTERYoud don't have a class file. Compile it first then run it. If your compiler isnt making the .class file tell me and ill give you a link to a realy good java compiler.
-
I don't know what to do with my ipad2?
I'm guessing you did not buy the iPad from Apple. If you did not buy it from Apple, it may very well have an older software version. Only iOS 5 or later is PC independent. If you have an earlier version, a computer with iTunes loaded is required.
Merry Christmas -
Help please! My phone has some kind of issue, besides being old, it has "magnified" I don't know what happened. I cannot figure out how to get it to go back to normal? It just happened when I touched a text message to read it. Does anyone know what I can do to fix this?
Double tap with three fingers
-
I'm so confused I don't know what is wrong with my router
I am clueless when it comes to this so any advice, please pretend like you're talking to a kindergartner. I have this WRT54GS router plus 3 computers. Two are desktops and they have a wireless adapter on them (also Linksys brand). One is a laptop with a built in wireless card. The main desktop is a dell, the other desktop is an emachines, and the laptop is a dell. All 3 are running winxp sp2. I got it all set up and all 3 seemed to be working fine and connected, both to one another and to the internet. Then I had to download a few windows updates on both the 2nd desktop and the laptop (first time going online for them) and when they rebooted they cannot link to the wireless connection. I tried all kinds of things. So I get on my main computer and neither of the other two are showing up. So I try fixing it and at one point it says to connect the computer to the router again (with the wire). So I do, and go through all the steps it tells me to go through, and now when I look at the available networks it says "wireless connection 2" instead of just wireless connection. And the other two still will not connect to the network. How do I get it back to how it was before-you know, when it was working. I am ready to uninstall everything and start all over but I can't really do that every day.
thanks for the reply! I think I got it working so far. I ended up calling and I could barely understand the guy I got but we got it done and he was really very nice and patient with me. I had some settings wrong. On my laptop I had to redo the windows zero configuration thing every time I started it but it looks like that's a common issue. I tried disabling the dell software managing my wireless so hopefully that will work today. So far *crossing fingers* the other two are working normally still. I left my main computer hooked up to the router though. I know it said I could disconnect it but that's where I started running into problems so I just left it connected. Hopefully that's ok. It's a desktop and isn't going anywhere so it's not a problem having it hooked up.
-
Dear All,
I am so wonder with my iPhone about the app. Weather. I tried to open again and again but I can't still open this app.
Pls kindly help to solve this problem and what I should do to process it..!try resetting the phone by holding the sleep/wake button and the home button until the phone restarts.
-
Please help me :(
You can try resetting your iPhone by simultaneously pressing and holding the Home and Sleep/Wake buttons until you see the Apple Logo. This can take up to 15 seconds so be patient and don't release the buttons until the logo appears.
Try again to see if the problem persists.
If still a problem, try deleting the hotspot (select the ⓘ, then tap Forget this Network) and adding it again. -
I don't know what's wrong with iPad
My ipad is going crazy. It's been typing on it's own, zooming and opening pages. Battery drains when I try to charge. I see many people have this same problem. Can't use ipad at all.
Please helpTake it to a Apple Store genius bar and if they find a hardware issue that is not fixable they will exchange for an out of warranty unit identical model
for
Out-of-Warranty Service
If you own an iPad that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will replace your iPad with an iPad that is new or equivalent to new in both performance and reliability for the Out-of-Warranty Service fee listed below.
iPad model
Out-of-Warranty Service Fee
iPad mini
$219
iPad, iPad 2,
iPad mini Retina
$249
iPad 3rd, 4th generation,
iPad Air
$299
A $6.95 shipping fee will be added if service is arranged through Apple and requires shipping. All fees are in US dollars and are subject to local tax.
Certain damage is ineligible for out-of-warranty service, including catastrophic damage, such as the device separating into multiple pieces, and inoperability caused by unauthorized modifications. However, an iPad that has failed due to contact with liquid may be eligible for out-of-warranty service.
Apple reserves the right to determine whether or not your iPad is eligible for Out-of-Warranty service. Replacement iPads have a 90-day limited hardware warranty or assume the remainder of your standard warranty or AppleCare product coverage, whichever is longer. Please see theAppleCare+ for iPad and Apple Repair Terms And Conditions for further details. -
I'm using the latest OS X, 10.8.5, on an iMac , 2.7GHz Intel Core i5. iTunes 11.6.
I've tried several formats, AIFF is the format that used to work.
Perhaps Apple has removed this ability to burn usable music CD's, just as it quietly removed iDVD?Hey mathgames!
There is an article that can help you troubleshoot this issue, and it is linked below:
Disc Burning Quick Assist
http://support.apple.com/kb/HT1152
Thanks for being a part of the Apple Support Communities!
Regards,
Braden -
The Youtube videos is loading slowly on my mac but it loads normally on other device. It always buzzing every single second.
One of the following steps should help.
1. Install Adobe Flash Player.
http://get.adobe.com/flashplayer/
Quit Safari.
Restart computer. Relaunch Safari.
2. Enable Plug-ins
Safari > Preferences > Security
Web Content: > "Enable Plug-ins".
or
Internet Plug-ins > "Allow all other plug-ins
3. Check whether you are currently in YouTube HTML 5 trial.
http://www.youtube.com/html5
At the bottom left of the page uncheck the box for
"You are currently in the HTML5 trial".
4. Reset Safari.
Click Safari in the menu bar.
From the drop down select "Reset Safari".
Uncheck the boxes next to all items.
Check the box next to "Remove all website data".
Click "Reset".
5. Turn off Extensions if any.
Safari > Preferences > Extensions
Best. -
Help!!! don't know what's wrong with it
I want to code a very simple chat program that whatever the client type, it will display in the server. Also, type in server will display in client. But code it but it doesn't work well. Below is the application I code, please help me to solve it. Thank you.
import java.net.*;
import java.io.*;
public class ChatServer
public static final int PORT = 8080;
public static void main(String[] args) throws IOException
ServerSocket s = new ServerSocket(PORT);
System.out.println("Started: " + s);
try
Socket socket = s.accept();
try
System.out.println("Connection accepted: " + socket);
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(
socket.getOutputStream())), true);
DataInputStream stdIn = new DataInputStream(System.in);
String serverInput, clientInput;
while(true)
if ((serverInput = stdIn.readLine()) != null)
out.println(serverInput);
if ((clientInput = in.readLine()) != null)
System.out.println("Client: " + clientInput);
out.println(clientInput);
if ((serverInput = stdIn.readLine()) == "end")
break;
finally
System.out.println("closing......");
socket.close();
finally
s.close();
import java.net.*;
import java.io.*;
public class ChatClient
public static void main(String[] args) throws IOException
InetAddress addr = InetAddress.getByName(null);
System.out.println("addr = " + addr);
Socket socket = new Socket(addr, ChatServer.PORT);
try
System.out.println("socket = " + socket);
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream())), true);
DataInputStream stdIn = new DataInputStream(System.in);
String clientInput, serverInput;
while (true)
if ((clientInput = stdIn.readLine()) != null)
out.println(clientInput);
if ((serverInput = in.readLine()) != null)
System.out.println("Server: " + serverInput);
out.println(serverInput);
if (clientInput.equals("end"))
break;
finally
System.out.println("closing..........");
socket.close();
}Hi,
Try my code... I make use of threads.
// server.java
import java.net.*;
import java.io.*;
public class server {
PrintWriter pr;
BufferedReader br;
public server(int port) throws Exception {
System.out.println("Type the following line on the client's side:\njava client " + InetAddress.getLocalHost().getHostAddress());
try {
ServerSocket ss = new ServerSocket(port);
Socket s = ss.accept();
System.out.println("Connection opened...");
System.out.println("Type \"END\" to close the connection...");
pr = new PrintWriter(new OutputStreamWriter(s.getOutputStream()), true);
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
new writeThread().start();
new readThread().start();
} catch (IOException ioe) {
debug(ioe.toString());
public static void main(String[] args) throws Exception {
server s = new server(1688);
static void debug(String s) {
System.out.println(s);
class writeThread extends Thread {
public void run() {
String l;
while (true) {
try {
l = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (l.equalsIgnoreCase("END")) {
pr.println("END");
System.exit(0);
} else {
pr.println(l);
} catch (IOException e) {}
class readThread extends Thread {
public void run() {
String l;
while (true) {
try {
l = br.readLine();
if (l.equalsIgnoreCase("END")) {
System.exit(0);
} else {
System.out.println("Client: " + l);
} catch (IOException e) {}
// client.java
import java.net.*;
import java.io.*;
class client {
PrintWriter pr;
BufferedReader br;
public client(String host, int port) {
try {
Socket s = new Socket(InetAddress.getByName(host), port);
System.out.println("Connection opened...");
System.out.println("Type \"END\" to close the connection...");
pr = new PrintWriter(new OutputStreamWriter(s.getOutputStream()), true);
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
new readThread().start();
new writeThread().start();
} catch (IOException ioe) {
debug(ioe.toString());
public static void main(String[] args) {
client c = new client(args[0], 1688);
static void debug(String s) {
System.out.println(s);
class writeThread extends Thread {
public void run() {
String l;
while (true) {
try {
l = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (l.equalsIgnoreCase("END")) {
pr.println("END");
System.exit(0);
} else {
pr.println(l);
} catch (IOException e) {}
class readThread extends Thread {
public void run() {
String l;
while (true) {
try {
l = br.readLine();
if (l.equalsIgnoreCase("END")) {
System.exit(0);
} else {
System.out.println("Server: " + l);
} catch (IOException e) {} -
What's wrong with the code?
public void run()
try
{ for(;;)
mgr = (RTPManager)RTPManager.newInstance();
mgr.addSessionListener(this);
mgr.addReceiveStreamListener(this);
try{ /*****port1 = port2 = 29261, which port is only used in here
localAddr = new SessionAddress(InetAddress.getLocalHost(), port1);
destAddr = new SessionAddress(ipAddr, port2);
}catch(Exception e)
System.out.println(e + " 4");
try{
mgr.initialize(localAddr);
}catch(Exception e)
System.out.println(e + " 5");
//set buffer
bc = (BufferControl)mgr.getControl("javax.media.control.BufferControl");
if (bc != null)
bc.setBufferLength(20);
try{
mgr.addTarget(destAddr);
}catch(Exception e)
System.out.println(e + " 2");
catch(Exception e)
System.out.println(e+ " 3");
the error when i run the code is like that:
javax.media.rtp.InvalidSessionAddressException: Can't open local data port: 29261
5
java.io.IOException: Address already in use: Cannot bind 2
which means there is error in :
mgr.initialize(localAddr);
mgr.addTarget(destAddr);
But i don't know what's wrong with the code,
can any one help me?I do not find any problem using the same ports for local and destination address with several unicasts. My problems are others.
But note that the error is even at constructing the localAddress, I mean before trying the destinationAddress. Thus the reason cannot be the former is already in use. In fact I think the later belongs to a remote hosts. Likely, it is trying to access the destinationAddress through the localAddress, but this has not been constructed properly.
Maybe you are looking for
-
How the system will caluclate price in billing doucment
hi gurus In billing doucment.( Invoice) how the price will come. 2) What is the use of document pricing procedure in billing document ( vofa) controling fields. Where do we use this document pricing procedure In which scenario this (document prici
-
Hi all. Just playing with extendscript toolkit and ps cs5, i Have an issue with javascript based panels. Both my attempts and toolscript samples ebete a New window object is created as panel or window disappear as Sion as shown. Otherwise modals pers
-
Adobe Photoshop Elements 2 Insta.
I want to Install 32bts in WINDOWS 7 Adobe Photoshop Elements 2, used with Windows XP thanks in advance
-
See above question.
-
Unable to create a mask on Adjustment layer
hi. I want to apply motion tracking data to a mask, therefore i'm trying to utilize an adjustment layer to control the mask position. So i tracked motion on a video footage, applied tracking data to Adjustment layer, then marked the Adjustment layer