The Artima Developer Community
Sponsored Link

Java Answers Forum
java problem

2 replies on 1 page. Most recent reply: Apr 4, 2006 1:41 PM by Arul Murugan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
jim gonolaz

Posts: 1
Nickname: jimmy21
Registered: Apr, 2006

java problem Posted: Apr 2, 2006 10:47 AM
Reply to this message Reply
Advertisement
I'm new to this site and java.

How do you design a java interface that includes the following methds: setKey, lock, unlock, and locked. The setKey method establishes the key. The setKey, lock, and
unlock methods take an integer parameter that represents the key. The lock and unlock methods lock and unlock the object, but only if the key passed in is correct. The locked method returns a boolean that indicates whether or not the object is locked.


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: java problem Posted: Apr 3, 2006 3:23 AM
Reply to this message Reply
Just declare the methods in a new interface with the parameters.
Instead of creating a method body just insert ';' after the header.


Note: We don't do other people's homework here.

Arul Murugan

Posts: 7
Nickname: appaney
Registered: Mar, 2006

Re: java problem Posted: Apr 4, 2006 1:41 PM
Reply to this message Reply
Hi Jim, Welcome to Java world. Hope that this will help you.


public interface TestInterface
{
private void setKey(int key);
private void lock(int key);
private void unlock(int key);
public boolean locked();

}

Flat View: This topic has 2 replies on 1 page
Topic: How to find size of a file (in terms of Bytes, KB, MB & GB..) using Java - Previous Topic   Next Topic Topic: Free Java Tutorials SITE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use