473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

I cannot see results

lotus18
866 512MB
Hello World

I made a simple program on creating new objects (student1 and student2). I compiled it and it is OK, but when I run it, I don't see results. I tried to insert from Line#4 to Line#36 after Line#2 but I'm getting compile error. Please guide me.

>>>Shifting to Java now : )

Expand|Select|Wrap|Line Numbers
  1. public class student{
  2.     public static void main(String args[]){
  3.     }
  4.      String student_id;
  5.      String lastname;
  6.      String firstname;
  7.      String address;
  8.      int score=0;
  9.     void get_student_id(String adStudentId){
  10.         student_id=adStudentId;
  11.     }
  12.  
  13.     void getlastname(String adLastName){
  14.         lastname=adLastName;
  15.     }
  16.  
  17.     void getfirstname(String adFirstName){
  18.         firstname=adFirstName;
  19.     }
  20.  
  21.     void getaddress(String adAddress){
  22.         address=adAddress;
  23.     }    
  24.  
  25.     int totalscore(int score1, int score2, int score3){
  26.         score=score1+score2+score3;
  27.         return score;
  28.     }
  29.  
  30.     void printoutput(){
  31.         System.out.println("studentid: " + student_id);
  32.         System.out.println("lastname: " + lastname);
  33.         System.out.println("firstname: " + firstname);
  34.         System.out.println("address: " + address);
  35.         System.out.println("totalscore: " + score);
  36.     }
  37.  
  38. }
  39. class bscs extends student{
  40.      public static void main(String args[]){
  41. //         int r=
  42.         student student1=new student();
  43.     student student2=new student();
  44.  
  45.     student1.get_student_id("2004-01287");
  46.     student1.getlastname("cañeso");
  47.     student1.getfirstname("reysean");
  48.     student1.getaddress("upper calarian, zamboanga city");
  49.         student1.totalscore(30, 45, 75);
  50.  
  51.     student2.get_student_id("2005-23652");
  52.     student2.get_student_id("maravilla");
  53.     student2.get_student_id("eunice");
  54.     student2.get_student_id("bonifacio, davao city");
  55.         student1.totalscore(30, 45, 75);
  56.  
  57.     student1.printoutput();        
  58.     student2.printoutput();
  59.     }
  60.  
  61. }
Rey Sean
Apr 12 '08 #1
9 1357
JosAH
11,448 Expert 8TB
You have an empty main(String[] args) { } method.

kind regards,

Jos
Apr 12 '08 #2
lotus18
866 512MB
Yes, I know it is empty. But as just like what I said in post#1, I cut the codes from line#4 to line #36 and inserted it after line #2 but I am getting compile error. How can I solve this and why am I getting an error?

Rey Sean
Apr 12 '08 #3
JosAH
11,448 Expert 8TB
Yes, I know it is empty. But as just like what I said in post#1, I cut the codes from line#4 to line #36 and inserted it after line #2 but I am getting compile error. How can I solve this and why am I getting an error?

Rey Sean
I am very sure that your compiler didn't just say "compiler error". It gave you the
line number and the text on the line as well as a descriptive text about the error
it had diagnosed. You have seen (and hopefully read) that text. We are not psychic
so why do you want us to guess?

kind regards,

Jos
Apr 12 '08 #4
hsn
237 100+
you should post the error description as Jos said.

and how can you execute a code without something in the main methode????

regards

hsn
Apr 12 '08 #5
sukatoa
539 512MB
Hello rey.... You forgot to remove your method main in student since your main class is in bscs..... and you extend the student class in bscs...

since you create an object from student class, your bscs should be the main class....

You must implement the bscs class in public.... and remove the public in student ( public class student ) if you like to compile it in a file....

You can still have that public in student if you save it in another file student.java....

based on the code @ original post...

try it bro....
sukatoa
Apr 12 '08 #6
JosAH
11,448 Expert 8TB
Well if the OP doesn't want to show us the code that's giving problems, I'm not
going to play editor and change some other code according to some directions
to what the OP had in mind. If someone wants to have his/her problem solved by
us, that someone should give clear descriptions of the problem and the actual
code that gives those problems. This is not a guessing game. I'm out of here.

kind regards,

Jos
Apr 12 '08 #7
lotus18
866 512MB
I am very sure that your compiler didn't just say "compiler error". It gave you the
line number and the text on the line as well as a descriptive text about the error
it had diagnosed. You have seen (and hopefully read) that text. We are not psychic
so why do you want us to guess?

kind regards,

Jos
Sorry for the trouble Joash.

To sukatoa, thanks bro. Now I got it. 'Till next time. : )
Apr 12 '08 #8
r035198x
13,262 8TB
.. 'Till next time. : )
... and hopefully you will follow Jos' advice when you do post "next time".
Apr 14 '08 #9
lotus18
866 512MB
... and hopefully you will follow Jos' advice when you do post "next time".
Yes r035198x. Have a niceday!

Rey Sean
Apr 14 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bob | last post by:
I am displaying a form with a datagrid populated from a select of database records which now exceed 12,000 when I select them all. The form displays just fine with all 12,000+ entries but when I...
1
by: Bob | last post by:
I am displaying a form with a datagrid populated from a select of database records which now exceed 12,000 when I select them all. The form displays just fine with all 12,000+ entries but when I...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: David C. allen | last post by:
I have created a simple Client-side SOAP Extension for a webclass that I have. When I apply the extension attribute to the the calling function in the proxy class I get an error 'Value cannot be...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
7
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output...
0
by: JGKjr | last post by:
I have a Web Application written in C#. I am trying to call a web service method and recieve the error: System.InvalidCastException: Cannot assign object of type System.Boolean to an object of...
2
by: Jakub Piotr Nowak | last post by:
Hello, In the following cgi program, I cannot get subprocess output. I print the header, flush stdout to prepare it to new content, but variable 'o' is always empty. Could somebody help me...
0
by: shaily | last post by:
hi I have a java web service called "Registration service" and C# client which is a consumer of that service java web service running under Tomcat has following interface API exposed ...
7
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.