Need a project... found a website on mindprod  
Author Message
John T





PostPosted: 2007-3-1 4:59:00 Top

java-programmer, Need a project... found a website on mindprod John T wrote:
> First, for those who may not already know, I am NOT a Java programmer. I
> am learning the language for my own purposes (
> Along with Ruby, XML, Perl and Groovy).
>
> I have sucessfully written a Java program which parses an XML file and
> am using it in my job. I am a technical support person, who specializes
> in printing systems, namely the way that our systems (HPUX and SunOS)
> interface with a print server running Easyspooler and Infoprint Manager.
>
> With that in mind, I think I am ready for a project. However, the
> closest thing I can come up with on my own, as anyone who has read any
> of my previous threads can tell, is some form of real world modelling. I
> am *not* convinced that this would be benefical to me as a learning
> experience.
>
> So let me elaborate on what I have been studying.
> I am familiar with classes, interfaces, packages and polymorphism,
> although interfaces and polymorphism are still somewhat foreign to me. I
> know a little bit about interfacing with Oracle and MySQL and have done
> a very rudimentary JSP page which talks to an Oracle database.
>
> Since I have no current projects in my job which require me to do any
> kind of Java programming (I came up with the XML parser as satisfying a
> need I had) I am looking for some suggestions.
>
> I have made my way through some of Eckle's book (and even have had an
> email from him). I have worked my way through the first portion of the
> Sun Java Tutorial. I've studied the Horstmann books (text for a class I
> took in Java) and, my favorite, Head First Java.
>
> I would like to do something with what I have learned. I'm not ready
> for GUI programming yet, nor do I want something trivial. Perhaps
> someone out there has written something along the lines of what I am
> looking for and would be willing to share with me the requirements for
> what they did. From the requirements, I can do a Use-Case and UML
> diagrams and from there, get to the coding.
>
> *Remember* I come from a procedural language (COBOL) background and have
> done very little OOP aside from SAS (does anyone remember SAS) and some
> Delphi, so please, be gentle. A simple project is all I am looking for.
> I'm not going to market it and I'm not going to post my code here
> looking for suggestions on how to clean it up.
>
>
Since no one has come up with anything I did a google search (GIYF) for
beginner java project and this is one of the sites which came up.

http://mindprod.com/projects/beginner.html

Do these make sense as beginner projects or am I out of my league again?
 
RedGrittyBrick





PostPosted: 2007-3-1 6:45:00 Top

java-programmer >> Need a project... found a website on mindprod John T wrote:
> Since no one has come up with anything I did a google search (GIYF) for
> beginner java project and this is one of the sites which came up.
>
> http://mindprod.com/projects/beginner.html
>
> Do these make sense as beginner projects or am I out of my league again?

I'd say they make sense as beginner projects, where your motivation is
to learn about Java.
 
John T





PostPosted: 2007-3-1 7:13:00 Top

java-programmer >> Need a project... found a website on mindprod RedGrittyBrick wrote:
> John T wrote:
>
>> Since no one has come up with anything I did a google search (GIYF) for
>> beginner java project and this is one of the sites which came up.
>>
>> http://mindprod.com/projects/beginner.html
>>
>> Do these make sense as beginner projects or am I out of my league again?
>
>
> I'd say they make sense as beginner projects, where your motivation is
> to learn about Java.
Here's another website I found...
http://www.javacoffeebreak.com/java106/java106.html

I'm going through the tutorial there and here's code for an Applet

/*
*
* HelloWorldApplet.java
* Demonstration for Java 106 tutorial
* David Reilly, August 24, 1997
*
*/

import java.awt.*;
import java.applet.*;

class HelloWorldApplet extends Applet
{
// Default constructor
public void HelloWorld()
{
// Call parent constructor
super();
}

Overridden paint method
public void paint ( Graphics g )
{
g.setBackground ( Color.white );
g.setColor ( Color.blue );
g.drawString ( "Hello world!", 0, size().height - 5);

}
}

But guess what...it doesn't compile

As you can see I copied and pasted it right from the site, so I didn't
make any typos

However, it appears to have at least 3 problems, 2 of which I think I
can correct...
Obviously this line

Overridden paint method

is meant to be a comment...easy to fix

// Overridden paint method

The second problem is with:

g.setBackground ( Color.white );

When I consult the API, I see that

setBackground ( Color.white ) is the correct way to issue a call to that
method... so two problems fixed

But the third one puzzles me


Here's the problem code

public void HelloWorld()
{
super();
}

Can you guess what Eclipse is saying about this...

Constructor call must be the first statement in a constructor

WTF... it looks to me like the call to super is the first
statement...doesn't that count as a constructor call.. or is it looking
for something else?

Now I don't mind fixing mistakes on websites that are supposed to be
learning experiences, but this one is beyond me. Is it something to do
with the jdk I'm using (1.6) or is the problem more insidious
 
 
Eric Sosman





PostPosted: 2007-3-1 7:21:00 Top

java-programmer >> Need a project... found a website on mindprod John T wrote On 02/28/07 18:12,:
> [...]
> public void HelloWorld()
> {
> super();
> }
>
> Can you guess what Eclipse is saying about this...
>
> Constructor call must be the first statement in a constructor
>
> WTF... it looks to me like the call to super is the first
> statement...doesn't that count as a constructor call.. or is it looking
> for something else?

It's the first statement, but it's not in a constructor
at all: it's in an ordinary method, and that makes no sense.
Lose the `void' in the declaration -- and remember that even
experts are prone to making mistakes in haset.

--
email***@***.com
 
 
John T





PostPosted: 2007-3-1 8:31:00 Top

java-programmer >> Need a project... found a website on mindprod Eric Sosman wrote:
> John T wrote On 02/28/07 18:12,:
>> [...]
>> public void HelloWorld()
>> {
>> super();
>> }
>>
>> Can you guess what Eclipse is saying about this...
>>
>> Constructor call must be the first statement in a constructor
>>
>> WTF... it looks to me like the call to super is the first
>> statement...doesn't that count as a constructor call.. or is it looking
>> for something else?
>
> It's the first statement, but it's not in a constructor
> at all: it's in an ordinary method, and that makes no sense.
> Lose the `void' in the declaration -- and remember that even
> experts are prone to making mistakes in haset.
>
Smart alec... :-) do you really work for Sun?

So is the void the only thing that differentiates between a method and a
constructor?
 
 
Lew





PostPosted: 2007-3-1 13:38:00 Top

java-programmer >> Need a project... found a website on mindprod John T wrote:
> So is the void the only thing that differentiates between a method and a
> constructor?

No. void is a return type, which only makes sense for a method, not a
constructor. Any other return type would have been just as incorrect in a
constructor declaration.

The tutorial covers constructors and describes how they differ from methods.
<http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html>

They are very different things. A constructor creates a new instance of a
class; a method performs an action.

-- Lew
 
 
John T





PostPosted: 2007-3-1 22:46:00 Top

java-programmer >> Need a project... found a website on mindprod
"Lew" <email***@***.com> wrote in message
news:email***@***.com...
> John T wrote:
>> So is the void the only thing that differentiates between a method and a
>> constructor?
>
> No. void is a return type, which only makes sense for a method, not a
> constructor. Any other return type would have been just as incorrect in a
> constructor declaration.
>
> The tutorial covers constructors and describes how they differ from
> methods.
> <http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html>
>
> They are very different things. A constructor creates a new instance of a
> class; a method performs an action.
>
> -- Lew

Thanks Lew. I understand now. Question:

Would this work

public void doSomething()
{
super();
}

or is the call to the super-class contructor only valid in another
constructor?



 
 
Hendrik Maryns





PostPosted: 2007-3-1 23:05:00 Top

java-programmer >> Need a project... found a website on mindprod -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John T schreef:
> "Lew" <email***@***.com> wrote in message
> news:email***@***.com...
>> John T wrote:
>>> So is the void the only thing that differentiates between a method and a
>>> constructor?
>> No. void is a return type, which only makes sense for a method, not a
>> constructor. Any other return type would have been just as incorrect in a
>> constructor declaration.
>>
>> The tutorial covers constructors and describes how they differ from
>> methods.
>> <http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html>
>>
>> They are very different things. A constructor creates a new instance of a
>> class; a method performs an action.
>>
>> -- Lew
>
> Thanks Lew. I understand now. Question:
>
> Would this work
>
> public void doSomething()
> {
> super();
> }
>
> or is the call to the super-class contructor only valid in another
> constructor?

Yes. You could do super.doSomething(), however, using *super* as a
reference to the super class. Compare to *this*. Assuming
doSomething() is declared in the super class, that is.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFF5uupe+7xMGD3itQRAsnpAJwNP6EX/zJVM0rvU8RsaZMSmsAqBwCdHuYB
A5IBKJ7uLLsKJsqER+VCCxA=
=BeRR
-----END PGP SIGNATURE-----
 
 
Patricia Shanahan





PostPosted: 2007-3-1 23:21:00 Top

java-programmer >> Need a project... found a website on mindprod John T wrote:
> "Lew" <email***@***.com> wrote in message
> news:email***@***.com...
>> John T wrote:
>>> So is the void the only thing that differentiates between a method and a
>>> constructor?
>> No. void is a return type, which only makes sense for a method, not a
>> constructor. Any other return type would have been just as incorrect in a
>> constructor declaration.
>>
>> The tutorial covers constructors and describes how they differ from
>> methods.
>> <http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html>
>>
>> They are very different things. A constructor creates a new instance of a
>> class; a method performs an action.
>>
>> -- Lew
>
> Thanks Lew. I understand now. Question:
>
> Would this work
>
> public void doSomething()
> {
> super();
> }
>
> or is the call to the super-class contructor only valid in another
> constructor?

Only valid as the first line of a constructor.

What are you trying to do? If you need a separate object of the
superclass type, use the "new" syntax. The superclass initialization for
"this" has already been done if you are inside a member method.

Patricia
 
 
John T





PostPosted: 2007-3-2 10:50:00 Top

java-programmer >> Need a project... found a website on mindprod Patricia Shanahan wrote:
> What are you trying to do?

.... make code that I found on a tutorial website compile.

When it was explained to me that the "void" on the so-called constructor
was causing the error, I was questioning why and how to fix it.