Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2008, 01:54 AM
Member
 
Join Date: Dec 2007
Posts: 13
cew27 is on a distinguished road
packages problem
right i have been trying to make the simplest subclass in my package but i cant seem to get it to work,
i have lost the source file i was using so could someone please make a source file for a simple bit of code called extendscew
all it is is

package hello.1.stuff;
public class extendscew{

public static void main(String args[]) {
string hello123 = ("hello 1");
system.out.println (hello123);
}
}

then another class that extends that
package hello.1.stuff

class extendscew1 extends extendcew {
public static void main(String args[]){
string hello123 = ("hello2")
system.out.println (hello123);
}
}


this is just a rough outline and is not syntax correct but when i try to make this i get a no class defound error so could someone please make the same simple 2 source files so i may compair them to mine when i find them and pinpoint the problem
greatly appreatiated
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-05-2008, 04:29 PM
Member
 
Join Date: Dec 2007
Posts: 16
Cazrin is on a distinguished road
Try:
Code:
package hello.1.stuff; public class extendscew{ public extendscew() { } // This is the line I've inserted public static void main(String args[]) { string hello123 = ("hello 1"); system.out.println (hello123); } }
You said it was a rough outline so I don't know if that's actually included in your source code.

Also on the extending class you don't have a ; at the end of your package hello.1.stuff or string hello123 = ("hello2") lines.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 12:28 AM
Member
 
Join Date: Dec 2007
Posts: 13
cew27 is on a distinguished road
thanks for the reply

ok one more problem here is the code
this is the first piece of code called oriigin that i will extend but at the moment i cant compile it because it says that a ; is expected at the end of the packages line?
Code:
package hello.1.stuff; public class origin{ public static void main(String args[]) { string hello123 = ("hello 1"); system.out.println (hello123); } }
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-09-2008, 02:46 PM
jelly's Avatar
Member
 
Join Date: Jan 2008
Location: Somerset, UK
Posts: 46
jelly is on a distinguished road
Each component part of a package name must conform to identifier naming rules, in particular this means they must start with a letter.

hello.1.stuff is invalid as the component '1' breaks those rules

hello.stuff or hello.s1.stuff would be valid.
__________________
-- Hope that helps
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-09-2008, 07:12 PM
Member
 
Join Date: Dec 2007
Posts: 13
cew27 is on a distinguished road
cheers for that i will give it a go tonight
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 01-10-2008, 11:14 PM
Member
 
Join Date: Dec 2007
Posts: 13
cew27 is on a distinguished road
right i dont know if i am doing this right or if i am following the rules of java but i cannot compile the code that extends the original
origin:
Code:
package com.google.stuff; public class origin { public origin() { } public static void main(String args[]) { int hello123 = 32; int hello1234 = 32; System.out.println(hello123 + hello1234); } }
extention:
Code:
package com.google.stuff; public class extentionorigin extends origin{ public static void main(String args[]) { int hello123 = 233; System.out.println(hello123 + hello1234); } }
this is probably way off the mark but all help is greatly appreciated, i have been stuck on this issue for months
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing packages from the packages within same application. sta2003 New To Java 3 02-12-2008 01:03 PM
Using packages prfalco New To Java 5 02-01-2008 12:38 AM
using Packages JavaForums Java Blogs 0 11-15-2007 07:50 PM
Closing packages uncopywritable New To Java 0 08-14-2007 01:47 AM
packages ai_2007 Advanced Java 1 07-31-2007 02:10 PM


All times are GMT +3. The time now is 02:18 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org