Wrox Programmer Forums
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2005, 04:59 PM
Registered User
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java classes

Java newbie here,

I've created a new class with the following code:

public classA(String Test, int Test2, String Test3) {

I'm then trying to create a new instance of this class from a different java file using the following code:

public void createClassA() {
    int none = 0;
    testArray[none] = new classA(("1234"+none),27+none,"help");

All I get when I compile it is error#.354 incompatible types; found: test.classA, required: java.lang.string

Its driving me insane. Can anyone help?

cheers

 
Old June 14th, 2005, 04:06 PM
Registered User
 
Join Date: Jun 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to LuisE Send a message via MSN to LuisE Send a message via Yahoo to LuisE
Default

can write out the whole error please?

public byte age = 17;
System.out.println("Just a Kid " + age + "years old");
 
Old June 21st, 2005, 03:24 AM
Registered User
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Spudgun2005,

Let us look at flaws in the code :
1. I cannot see declaration of testArray[] anywhere with mention of its type (if type = classA or so) . Seems from the incomplete code in constructor below , it returns a string type.
2. public classA(String Test, int Test2, String Test3) is a constructor and constructors do not return any type so it cannot return String for
testArray[none] = new classA(("1234"+none),27+none,"help");
3. Arrays are not declared the way you have done . Please refer to some good book.

Hope it helps .

Thanks,
Prasad


Thanks,
Prasad





Similar Threads
Thread Thread Starter Forum Replies Last Post
tomcat, jsp, java classes Befekadu Apache Tomcat 3 April 2nd, 2009 07:30 AM
Help needed regarding Java classes sadz123 Java Basics 2 February 11th, 2009 08:49 AM
Using Java Classes from C# gettipu General .NET 0 February 7th, 2005 06:59 PM
Compile Java classes to EXE vb_programmer Java GUI 7 December 14th, 2004 08:16 AM
ASP support for classes written in Java... rdwash Classic ASP Components 1 July 18th, 2003 11:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.