Results 1 to 13 of 13
Thread: Java in unfamiliar realms !!
- 04-24-2009, 04:34 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
Java in unfamiliar realms !!
I am an amateur programmer and learning languages 'for the sake of learning' and not necessarily for becoming a fire-brand programmer. I had started with C++ and have quite a lot of proficiency with it. Along the way, I found that Java has a familiar code and I have done quite a lot of codes on it as well. I have practised on command prompt(on win98 only), Eclipse, JCreator and drJava, the latter three on both windows. Everything was going well till something like the following arrived.
And everything has gone for a toss. Nothing seems to work and it is so frustrating.Java Code:public class GradeBookTest { public static void main( String args[] ) { GradeBook myGradeBook = new GradeBook(); myGradeBook.displayMessage(); } }
I have installed jdk1.5.0_18( on win98/winXP). On winXP I had continued all my practice without even setting path(Of course, on win98 I had to set path for working on command prompt)
The present situation is that even after setting the path on winXP ,as follows, nothing appears to work.
''""go to MY COMPUTERS
-->properties
-->advanced
-->environment variables
now u have user variables and system variables
below user variables u have 3 options
new edit delete
click on new
a box with varaiable name and variable value gets opened
enter variable name as 'class path'
variable value as
(drivein which java is stored):\program files\java\jdk(version)\lib;
egs: C:\program files\Java\jdk1.6.0\lib;
enter variable name as 'path'
variable value as
(drive in which java is stored):\program files\java\jdk(version)\bin;
egs: C:\program files\Java\jdk1.6.0\bin;''""
What I am curious to know is whether there is a quantum jump in Java due to which it has entered unfamiliar realms requiring substantial change in working environment ??
- 04-24-2009, 04:37 PM #2
What errors are you getting? Do you have the GradeBook class in your project?
- 04-24-2009, 04:53 PM #3
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
I am on win98 and on the following code in drJava (which shows compiler jdk5.0_18)
And I am getting the following errorJava Code:public class GradeBookTest { public static void main( String args[] ) { GradeBook myGradeBook = new GradeBook();//Error Here myGradeBook.displayMessage(); } }
"""
Error:cannot find symbol
symbol: class GradeBook
location: class GradeBookTest
"""
- 04-24-2009, 04:55 PM #4
yep as I thought, GradeBook is a User written class. Write a GradeBook class and that error will go away.
That code looks familiar, is it out of a book?
- 04-24-2009, 04:58 PM #5
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
- 04-24-2009, 05:07 PM #6
hmm, not to familiar with OO then?
in a seperate file in your project
hope that helpsJava Code:public class GradeBook { public GradeBook() { //This is your constructor } // your code calles this method from within GradeBook so you have to write it too public void displayMessage() { System.out.println "GradeBooks display message"; } }
- 04-24-2009, 05:38 PM #7
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
I am very sorry, the code appears to be from chapters I have not attempted yet. However if you wish you may provide help.Java Code:public class GradeBook { public GradeBook() { //This is your constructor} // your code calles this method from within GradeBook so you have to write it too public void displayMessage() //Error: Illegal start of expression { System.out.println ("GradeBook display message"); } } //Error: Expected ; }
- 04-24-2009, 05:40 PM #8
Thats alright, If you have any other questions don't be afraid to ask!
- 04-24-2009, 05:44 PM #9
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
Many many thanks !! This code relates to which chapter ??
- 04-24-2009, 05:45 PM #10
no idea, your the one with the book. Which book are you using anyway?
- 04-24-2009, 05:53 PM #11
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
In the book I got recently, Java How To Program( I have been practising from other books) this code ,surprisingly, appears very early in chap 3 -- Classes and Objects. Is the student required to know so much so early ??
- 04-25-2009, 01:27 AM #12
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 5
Yes... in Java, Classes are the basis of all programs. In fact, it is possible to write a fully functional program using nothing but Classes, however, this can become difficult and make code difficult for a more advanced programmer to understand, as Classes, Interfaces, and Enums are used for different reasons. However, with a bit of work, it is possible to create a class that will imitate an Interface or an Enum, though you cannot use multiple Classes that act as an Interface within a class, as Java does not support multiple inheritance. However, you should definitely focus on learning about Classes, and as for Objects, well, an instance of a Class is, in effect, an Object. If I were you, I would do some very thorough reading of that chapter.
If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
- 04-25-2009, 10:14 AM #13
Member
- Join Date
- Feb 2009
- Posts
- 20
- Rep Power
- 0
Similar Threads
-
Mighty Realms Hearts gets Reviewed!
By Xyle in forum Java SoftwareReplies: 0Last Post: 04-11-2009, 04:20 AM -
Unfamiliar Syntax "int x = i1 << 24 | i2 ..."
By KentDMc in forum New To JavaReplies: 5Last Post: 04-11-2009, 03:21 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks