Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Need help,homework

Reply
Thread Tools

Need help,homework

 
 
theunknowable@lavabit.com
Guest
Posts: n/a
 
      12-11-2012
Nooblet here, I need to write this application, I got as far as making 6
empty classes and originally needed to use swing, though since I need to
learn swing I may just make it a console application and get less points
for it. I need to be able of writing to disk the data (utilizing user
input), deleting it when I want too and show I understand how classes
work. While I understand extends, I don't quite understand what implement
does.

Extends allows you to use the methods and variables of the class you
extended (inheritance). Implement seems similar?

Anyways, since I only have 1 day to do this and I've been trying to do
this for weeks, what are the classes available that will allow me to:

1.) Write a plain text file to disk?
2.) read the file?
3.) delete the file?
4.) check for the existence of the file?
5.) search for the file?
6.) compare files?

Where can I learn more about these specific classes? Any example code that
is small and simple to read?
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-11-2012
(E-Mail Removed) wrote:
> Nooblet here, I need to write this application, I got as far as making 6
> empty classes and originally needed to use swing, though since I need to
> learn swing I may just make it a console application and get less points
> for it. I need to be able of writing to disk the data (utilizing user
> input), deleting it when I want too and show I understand how classes
> work. While I understand extends, I don't quite understand what implement
> does.
>
> Extends allows you to use the methods and variables of the class you
> extended (inheritance). Implement seems similar?


'extends' is the keyword to inherit from a class, including implementation of methods.

'implements' is the keyword for a _class_ to inherit from an interface, including only
method signatures from the interface and leaving details of implementation entirely
up to the implementing class.

An interface can use 'extends' to inherit from another interface. Because an interface
contains no implementation, it cannot 'implements' an interface.

> Anyways, since I only have 1 day to do this and I've been trying to do


You're going to have a hard time. Usenet isn't necessarily a one-day turnaround, and
learning Java can take a few days.

> this for weeks, what are the classes available that will allow me to:


Tutorials and Javadocs.

Tutorials:
http://docs.oracle.com/javase/tutorial/

Javadocs:
http://docs.oracle.com/javase/7/docs/api/

> 1.) Write a plain text file to disk?

http://docs.oracle.com/javase/tutori.../io/index.html
http://docs.oracle.com/javase/7/docs...ileWriter.html

> 2.) read the file?

http://docs.oracle.com/javase/7/docs...ileReader.html

> 3.) delete the file?

http://docs.oracle.com/javase/7/docs...a/io/File.html

> 4.) check for the existence of the file?

http://docs.oracle.com/javase/7/docs...a/io/File.html

> 5.) search for the file?

http://docs.oracle.com/javase/7/docs...a/io/File.html
plus
http://docs.oracle.com/javase/7/docs...ileFilter.html
plus
http://docs.oracle.com/javase/7/docs...ameFilter.html
plus glue code.

> 6.) compare files?

Read the files and compare contents. You'll need to be more specific about what you
mean by "compare".

> Where can I learn more about these specific classes? Any example code that
> is small and simple to read?


http://lmgtfy.com/?q=Java+simple+file+I%2FO

--
Lew
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      12-12-2012
On Tue, 11 Dec 2012 00:21:22 +0000 (UTC), http://www.velocityreviews.com/forums/(E-Mail Removed)
wrote, quoted or indirectly quoted someone who said :

>While I understand extends, I don't quite understand what implement
>does.


see http://mindprod.com/jgloss/implements.html
http://mindprod.com/jgloss/class.html
http://mindprod.com/jgloss/interface.html
--
Roedy Green Canadian Mind Products http://mindprod.com
Students who hire or con others to do their homework are as foolish
as couch potatoes who hire others to go to the gym for them.
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      12-12-2012
Roedy Green wrote:
> theunknowable... wrote, quoted or indirectly quoted someone who said :
>
>> While I understand extends, I don't quite understand what implement
>> does.

>
> see http://mindprod.com/jgloss/implements.html
> http://mindprod.com/jgloss/class.html
> http://mindprod.com/jgloss/interface.html


OP, you'd be better off with the Oracle documentation and Google, whereby you
can get more accurate and insightful information.

Roedy is fond of driving traffic to his site from here. You might find something
somewhat useful there, but you're far more likely to benefit from authoritative sources.

--
Lew
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      12-13-2012
On 12/11/2012 9:37 PM, Roedy Green wrote:
> On Tue, 11 Dec 2012 00:21:22 +0000 (UTC), (E-Mail Removed)
> wrote, quoted or indirectly quoted someone who said :
>> While I understand extends, I don't quite understand what implement
>> does.

>
> see


I am not sure that is good advice.

> http://mindprod.com/jgloss/implements.html


#implements is a keyword used on class or interface statements.

class and interface are not statements.

And an interface can not implements by definition.

> http://mindprod.com/jgloss/class.html


#Let’s say you had a TV class to deal with television sales. There are
#two kinds of variables:
#
# static variables that track facts about all televisions in
#general, e.g. total sold or a list of manufacturers.

That sounds like an awful design to me.

> http://mindprod.com/jgloss/interface.html


#The throws clauses about Exceptions in the interface’s methods must
#exactly match the throws clauses of the implementing methods.

No.

The implementing method can not throws an exception not in
the interface, but it does not need to throws all exceptions
in the interface.

Arne


 
Reply With Quote
 
Robert Klemme
Guest
Posts: n/a
 
      12-14-2012
On 12/13/2012 02:42 AM, Arne Vajhøj wrote:
> On 12/11/2012 9:37 PM, Roedy Green wrote:


>> http://mindprod.com/jgloss/interface.html

>
> #The throws clauses about Exceptions in the interface’s methods must
> #exactly match the throws clauses of the implementing methods.
>
> No.
>
> The implementing method can not throws an exception not in
> the interface, but it does not need to throws all exceptions
> in the interface.


<nitpick>The implementing class can choose to declare a more restrictive
throws clause, which means, sub classes of declared exceptions in the
interface as well as a shorter throws clause. And it is allowed to
throw all exceptions which are mentioned in the throws clause or sub
classes of them.</nitpick>

Kind regards

robert

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      12-15-2012
On 12/14/2012 2:03 AM, Robert Klemme wrote:
> On 12/13/2012 02:42 AM, Arne Vajhøj wrote:
>> On 12/11/2012 9:37 PM, Roedy Green wrote:

>
>>> http://mindprod.com/jgloss/interface.html

>>
>> #The throws clauses about Exceptions in the interface’s methods must
>> #exactly match the throws clauses of the implementing methods.
>>
>> No.
>>
>> The implementing method can not throws an exception not in
>> the interface, but it does not need to throws all exceptions
>> in the interface.

>
> <nitpick>The implementing class can choose to declare a more restrictive
> throws clause, which means, sub classes of declared exceptions in the
> interface as well as a shorter throws clause. And it is allowed to
> throw all exceptions which are mentioned in the throws clause or sub
> classes of them.</nitpick>


Good point.

"not in the interface" must be "not instance of one in the
interface" or "not assignable to one in the interface".

Arne



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to "shred" hardive..need software. Xeno Chauvin Computer Support 4 03-13-2005 01:26 PM
Need help with need to Force Garbage Collect John Java 1 08-19-2004 03:32 PM
Need help! I need to add lead zeros to a textbox Teep ASP .Net 2 06-21-2004 01:04 PM
Please help!!! Need datagrid selection to fill textboxes...Need quick!! TN Bella ASP .Net 1 06-18-2004 01:31 AM
Need to compare Photos to DVD software - Need Help? Bob Digital Photography 4 02-04-2004 02:13 AM



Advertisments