Working on first Java project in Ecplise and need some help

I am working on a Java project. I am working a programme to show sets of requirements to a software engineer. At the end the programme will show all consistent requirements with no conflicts between them.
I am working on the first section. This invloves creating a class with a HashSet to insert the requirements in to the class. I am using this code at the moment
import java.util.HashSet;
import java.util.Set;
public class requirements {
     public void HashSet() {
          Set<String> requirements = new HashSet<String>();
          //Declare some string items
          String item_1 = "r1";
          String item_2 = "r2";
          String item_3 = "r3";
          boolean result;
          //Add the items to the Set
          result = requirements.add(item_1);
          System.out.println(item_1 + ": " + result);
          result = requirements.add(item_2);
          System.out.println(item_2 + ": " + result);
          result = requirements.add(item_3);
          System.out.println(item_3 + ": " + result);
          //Now we try to add item_1 again
          result = requirements.add(item_1);
          System.out.println(item_1 + ": " + result);
          //Adding null
          result = requirements.add(null);
          System.out.println("null: " + result);
          //Adding null again
          result = requirements.add(null);
          System.out.println("null: " + result);
     public static void main(String[] args) {
          new requirements().HashSet();
the class is called requirements and I get these errors
Return type of the method is missing
Syntax error on token class, delete this token
Syntax error on token misplaced construct
Syntax error insert Enum body to complete EnumheaderName
Syntax Error insert Enum body to complete enum decleration
The public type requirements must be defined in its own file.
The next stage would be to send the Hashset to another class to perform operation on the set. The other class is called specification. Can anyone help me to resolve the errors and pass the set to the other class.
Thanks

muj wrote:
I am working on a Java project. I am working a programme to show sets of requirements to a software engineer. At the end the programme will show all consistent requirements with no conflicts between them.
I am working on the first section. This invloves creating a class with a HashSet to insert the requirements in to the class. I am using this code at the moment
import java.util.HashSet;
import java.util.Set;
public class requirements {
     public void HashSet() {
          Set<String> requirements = new HashSet<String>();
          //Declare some string items
          String item_1 = "r1";
          String item_2 = "r2";
          String item_3 = "r3";
          boolean result;
          //Add the items to the Set
          result = requirements.add(item_1);
          System.out.println(item_1 + ": " + result);
          result = requirements.add(item_2);
          System.out.println(item_2 + ": " + result);
          result = requirements.add(item_3);
          System.out.println(item_3 + ": " + result);
          //Now we try to add item_1 again
          result = requirements.add(item_1);
          System.out.println(item_1 + ": " + result);
          //Adding null
          result = requirements.add(null);
          System.out.println("null: " + result);
          //Adding null again
          result = requirements.add(null);
          System.out.println("null: " + result);
     public static void main(String[] args) {
          new requirements().HashSet();
the class is called requirements and I get these errors
Return type of the method is missing
Syntax error on token class, delete this token
Syntax error on token misplaced construct
Syntax error insert Enum body to complete EnumheaderName
Syntax Error insert Enum body to complete enum decleration
The public type requirements must be defined in its own file.
The next stage would be to send the Hashset to another class to perform operation on the set. The other class is called specification. Can anyone help me to resolve the errors and pass the set to the other class.
ThanksReading your code, it looks wrong... but it turns out that a lot of it was because you did not use CODE brackets like this:
{+code}
System.out.println("hello");
{code+}
becomes
   System.out.println("hello");It also seems that you code works as it is.
though I recommend putting classes inside a package.
Syntax error insert Enum body to complete EnumheaderNameWhere is this even in your code? Did you post the code you had a problem with?

Similar Messages

  • I'm new to itunes and need some help. Can anyone tell me if it is possible to download an album which has explicit content without actually downloading the explicit songs?

    I'm new to itunes and need some help.  Can anyone tell me if it is possible to download an album which has explicit songs without actually downloading the songs that are explicit?

    See if there's a non-explicit version and download that?  Just download the individual songs you want, and not the others?
    Honestly, your phrasing doesn't make sense.  You're asking how to download an album without downloading its tracks? 

  • First Java Project - Document Management and Workflow

    We are about to embark on our first java project around document management and workflow.
    I would be interested to know how others have approached similar projects – Open Source applications or other tools/APIs.
    It would also be good to know of any issues encountered along the way.
    Thanks,
    Steve

    Hi Husein,
    I appreciate your interest in procuring a Document Management/Workflow solution for your AP department...its a very smart move toward streamling that process!
    I sent an email today to Richard Braddock about our solutions. I would be happy to discuss them with you.
    My office phone number is 215-646-8000
    -Martin

  • I can't access the internet with Firefox on my computer (Windows 7 PC). I have used Firefox as my browser for 1 year but 5 days ago it stopped working even though Internet Explorer worked fine. I can't solve the problem and need some help.Randy Brown

    September 26, 2011
    Dear Mozilla,
    I am having some difficulty accessing the internet with Firefox on one of my PC computers. I normally use Mozilla Firefox as my web browser and google is my homepage and gmail is my email system. The operating system is Windows 7. For over a year this system worked perfectly but a few days ago it stopped working. When I launch Firefox now I get the message that that website (www.google.com) is unavailable. In fact, I can’t access any website and I am blocked from the internet entirely within Firefox. My internet connection is fine because Internet Explorer works fine. I can access google and any other website within that web browser. I have investigated all the security issue I can manage and found no smoking gun. I’ve tried uninstalling and reinstalling Firefox to no avail. Is Windows 7 compromising the effectiveness of Firefox? Any suggestions or other assistance you can offer would be appreciated.
    Sincerely,
    Randy Brown
    [email protected]

    You only have to clone your mac when using certain cable modem.  You don't clone your mac when using dsl.
    Greetings from Northern Ontario, Canada

  • I'm new here and need some help or should I say guidance.

    Hey Forum peeps,
    I have a treo 700wx working on Sprints network and running on windows mobile version5.  I am a BIG game freak and am looking to download a playable version of Maniac Mansion (any version) and I dont know how to go about doing this.  I have read it is a playable game but I am NO techie and need to be walked through step by step so hopefully someone out there will remember what it was like to first start out and give me a helping hand.
    Post relates to: Treo 700wx (Sprint)

    Hi..  Welcome to the Palm forums.  This process is used to install any 3rd party program onto your 700wx.  First connect the usb cable and sync.  Now on your computer go on the web and find you program/game you are looking for that is in a windows mobile 5 format, compatable with wm5 and download it to your computer.  It will be a compressed file in a .zip format most likely.  Go to where you saved the file and right click on it and select extract here.  Once extracted you should have a setup file which you run to install the program.  Follow that process and it will realize it is a windows mobile file and install it accross the cable to the 700wx.  When it is finished on the computer it will tell you to check the 700wx for further instructions.  At that point check the screen on the device and follow the directions.  The key is to download a file that is windows mobile compatable, if you download a palm os format file or other mobile operating system file it will not install.  Hope that helps.
    Post relates to: Centro (Sprint)

  • I'm new wiith Blackberry and need some help

    Hi There,
    I'm working on a school in the netherlands and thay are thinking here to give some people a blackberry phone to syncronize there calendar and mail. We are using a Microsoft Exchange 2007 server (with webacces active) for the calendar and mail and so on.
    On colleauge now has a Blackberry 8520 and wants to syncronize his exchange account with the blackberry. We tried it and when setting up the mail we did chose "using webmail" and the mail works. However the calendar and contacts don't work.
    Is it possible to syncronize a Blackberry with a exchange account (mail, calendar and contacts) without having a blackberry server? When it is possible, how do we have to o it?
    Thanks,
    Marcel

    Hi and Welcome to the Forums!
    The configuration I think you have is MS Exchange on the back end fronted (to the Internet) by Outlook Web Access (OWA). As such, Blackberry Internet Service is the interface between OWA and the BB...there is no direct interaction between the BB and the Exchange server. As such, only email will reconcile wirelessly in this configuration. Calendar, contacts, and other items must be reconciled via USB/BT tether.
    Now, that said, there is a free solution to do what you desire -- it's called BES Express. BES is BlackBerry Enterprise Solution and provides OTA sync of email, calendar, contacts, etc. Full BES is not free. But BES-X is. If you truly require full reconciliation of all things from Exchange, I recommend you research BES-X.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Chain step is being skipped and need some help with why?

    Hi, all.
    I'm hoping for some help from the community again.
    There's a chain created (code below) and it's running successfully -- at least it's building MOST tables.
    The problem is: the last three tables are all dependent on the same condition and only two of them run.
    From the code below, step 4, step 5 and step 6 are all dependent on the success of step 3.
    When the job for this chain is run, all the steps run successfully except for step 5.
    The interesting thing (to me at least) is that whichever table build is step 5 fails.  For example, in the code below prog_Y is assigned to step 5 and it fails.  If I swap prog_Y to step_4 and prog_X to step_5, step_5 still fails.  Same result if prog_Z is listed as step 5.  While steps 4 and 6 run successfully.
    The additional info in job run details lists: table or view does not exist.  However, I've confirmed the procs behind the programs each run successfully and the tables do exist.
    I've tried several things to get more info: changing the step numbers.dropping/redefining step, dropping chain and redefining, retyping the steps and rules.
    Please help.  Any suggestions of why this step 5 might be failing or where to look for more information is super helpful.
    Thanks so much
    Fritz
    When the chain is run partially
    /* 1. Create Chain */
    BEGIN
    dbms_scheduler.create_chain (
    CHAIN_NAME => 'dgr_cmpl_chain',
    RULE_SET_NAME => null,
    EVALUATION_INTERVAL => null,
    comments => 'Chain which loads the degree completion tables.');
    END;
    /* 2. Define the steps in the chain */
    BEGIN
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_1',
       program_name    =>  'prog_intrmdt_1');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_2',
       program_name    =>  'prog_intrmdt_2');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_3',
       program_name    =>  'prog_base');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_4',
       program_name    =>  'prog_X');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_5',
       program_name    =>  'prog_Y');
    DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
       chain_name      =>  'dgr_cmpl_chain',
       step_name       =>  'step_6',
       program_name    =>  'prog_Z');
    END;
    /* 3. Add rules */
    BEGIN
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'TRUE',
       action       =>   'START step_1',
       rule_name    =>   'rule_1',
       comments     =>   'Start Degree Completion chain.');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_1 succeeded',
       action       =>   'START step_2',
       rule_name    =>   'rule_2');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_2 succeeded',
       action       =>   'START step_3',
       rule_name    =>   'rule_3');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_3 succeeded',
       action       =>   'START step_4',
       rule_name    =>   'rule_4');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_3 succeeded',
       action       =>   'START step_5',
       rule_name    =>   'rule_5');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_3 succeeded',
       action       =>   'START step_6',
       rule_name    =>   'rule_6');
    DBMS_SCHEDULER.DEFINE_CHAIN_RULE (
       chain_name   =>   'dgr_cmpl_chain',
       condition    =>   'step_4 completed and step_5 completed and step_6 completed',
       action       =>   'END',
       rule_name    =>   'rule_7');
    END;
    /* 4. Enable the chain */
    BEGIN
    DBMS_SCHEDULER.ENABLE ('dgr_cmpl_chain');
    END;
    /* 5. Create a job that points to the chain. */
    /*Utilized Job wizard to create job */

    Thanks much for your suggestions.  Very grateful.
    Looks like this may have been a self-inflicted error.
    There were some other errors that confound this explanation.  But right now this seems to be the most likely case.
    The END condition initially was step 6 completed.  Turns out, when step 3 succeeded, all steps 4, 5 and 6 were kicked off simultaneously.  Well, step 6 had a shorter run time than step 5.  So step 6 would finish and trigger the end of the chain before step 5 finished.
    This has been consistently working since the END condition was updated to evaluate steps, 4, 5 and 6.
    Fritz

  • I need to call some privileged APIs and need some help on this.

    First the Basics:
    This program auto-launches each time a user logs in. It is an authentication type of program. Only users with this app running will be allowed to use a secure network.
    I need to be able to read and write from the route / arp tables, and possibly be able to 'reset' a network adapter. These are the privileged APIs I need to call. I have only found "UNIX" APIs to do this, no apple APIs although I am sure they would have the same restrictions.
    Anyway, what I don't want is that elevate privileges prompt each time a user logs in. I am sure this would become very annoying.
    Possible solutions (I have no idea how to do these):
    1. The installer sets it up to run with admin / privileged access when it starts. I only know how to get a program to start with user privileges (the one that logged in).
    2. The installer flags / registers something that this app can make those API calls. IE: The App is trusted.
    3. The program is split in to two parts and uses Interprocess communication to talk to the privileged part. This still leaves problem #1, how do you get an app to launch as privileged.
    Any other ideas and suggestions would be welcomed.

    What you normally do in this case is write a kernel extension that does all the work and then have a user interface that the user runs. What you are describing sounds very much like a VPN. This is exactly how the Cisco VPN software works, for example.

  • Just purchased a used G4 and need some help

    First, let me say, that I am finally returning to the fold after years of working on a PC (employers insisted) but have just purchased a used G4 running OS 10.3.8 I've registered the G4 and everything, and tried to update the OS. I got a "mounting failed" message. It may be because the previous owner left a password in the automatic update file and didn't tell me what it was. Also, they did not provide me with the original installation discs so I could use administrator access to disable this password! Anyway, I want to update the OS as far as it can go - any idea how I can do this? I've searched around the apple site for a while now, seeing if I could purchase replacement installation discs, but can't find any into. If I just go ahead and purchase the 10.4 upgrade, can I install it without upgrading from 10.3.8?
    Sorry if these are basic questions, but my last mac was an Apple IIc be kind.

    Hello nebpen,
    "While the lamp hold out to burn, the vilest sinner may return!"
    Welcome back!
    As the Texas Mac Man says, you need the install CDs (and Applerescue is a good source). Your DA will run any Apple OS out there at its latest update. I happen to prefer Panther, mostly, I suppose, because it's simpler ... or run them both!
    Further, IMHO, the DA is the sweet spot in balancing cost and performance. I'm still feeling my way with upgrades, but every day mine seems to run better. I've just discovered how to adapt an 867mhz QS cpu, so the backup is now running faster than the Main Mac, and I even had to install Tiger (10.4.10) to take advantage of the latest Google Earth. What incredible pictures!
    Anyhow, welcome!
    Jon

  • I'm new and need some help.

    Hello Everyone,
    I bought my Lenovo 3000 last August and the keyboard letters started rubbing off and when I called they said it send it in. I sent it in and all of a sudden I had a liquid spill. I only had the computer less than three months. I never even spilled liquid on the laptop. Then all of a sudden my computer was returned with a new keyboard. Nothing else was said about the liquid spill.
    Fastforward.  My computer started acting weird in April 08 and I called to get help. For two months they had me downloading things from their site saying it would work. I finally got someone to help me then they said my warrenty was up, I had to send all my information in again and then I sent in my computer. When I sent it in, I didn't hear anything for a week and then I received a call and a massage saying I had liquid spill. I never wasted water on the computer or any other liquid. They told me it was going to be 800.00 plus change to fix and said they wasn't doing anything to the computer without me paying up front. This was just about the amount I paid for the laptop. Since they sent the laptop back, it doesn't work. Now my keyboard doesn't work and I don't know what to do. My warrenty has now expired on 8/16. Does anyone know where I can get my laptop repaired?

    Thank you for responding. This is my first computer/laptop. I didn't know I could have requested that. I can't send it back now b/c my warrenty is up. Does anyone know of a good repair place then or is this a lost cause?

  • In a Bind and Needing Some Help ASAP

    Hello-
    I need my MacBook Pro with Safari (latest version) and OS X 10.6.6 tomorrow for a presentation and I tried just like I did with the last Flash update to install it and I messed things up.  TechTracker told me there was an update for Flash so I clicked "yes" to download and install.  I am new to TechTracker and installing Flash, but whatever happened my MacBook is not useable right now and it was before I clicked "OK" to update Flash.
    I also tried it on my own, but there must be more detailed instructions than what Adobe  makes obvious to newbies (Flash update newbies).
    since I use Safari as my browser, it shows what plug-ins I have on a webpage that is part of Safari browser.  First off, is it too early to update to the latest version of Flash?  is this a program that I should wait awhile when a newer version comes out?
    If it is OK to go ahead and update Flash, can somebody lead me to a link or website that explains how to update Flash?  it obviously is not like other programs, because I have done the install ust like I would other programs or updates but I am not getting it right.
    I would really appreciate it if somebody could guide me through the process or send me to a site that explains what I need to do.
    Finally, I have heard that Shockwave Player (which is not installed on my macBook Pro) is a great program along with Flash to have on my macBook pro.  is this true or am I risking causing more conflicts and/or problems by installing shockwave for macs once I get Flash straightened out.

    Yikes, ArrayIndexOutOfBounds (stanz answer)
    Here is working code that does what you want.
          * This method finds the smallest Int value in the array.
         public static int findSmallest(int[] array) {
              int min = Integer.MAX_VALUE;
              for (int i = 1; i < (array.length); i++) {
                   if (array[i] < min)
                        min = array;
              return min;
         public static void main(String[] args) throws IOException {
              Test t = new Test();
              Scanner scan = new Scanner(new FileInputStream("C:\\Testing\\junk\\classes\\new.txt"));
              int size = scan.nextInt();
              scan.nextLine();
              int[] array = new int[size];
              for(int i = 0; i< size; i++)
                   array[i] = scan.nextInt();
                   scan.nextLine();
              int smallest = findSmallest(array);
              System.out.print(smallest);
         } // end method
    Message was edited by:
    SomeoneElse

  • Brand new to the Mac World and NEED SOME HELP with startup disk issues

    Hello everyone. I am a new Mac user and I purchased my mac on ebay. It's an iMac that came with tiger 10.4.11. I wanted to get a fresh start on the computer, since the person who had it before me did not erase all of his stuff. I didn't know what to do so I got a startup disk/install disk off ebay also. When I go to install it says "software cannot be installed on this computer." Before I bought the software, I had called the apple store and they said it should be fine to buy any install software to put on the computer. If I could get any help it would be appreciated. I had read previous threads that I should hold down c when I start up (didn't work) or that I should select archive or erase and install (I never got these options when I went to install).

    A warm welcome to the Discussions!
    What iMac is it? I only ask as the Retail Tiger CD/DVDs don't work on IntelMacs, only PPC, (G3, G4, G5 Macs).
    Sorry what you were told by the Apple Store, but if it's a Gray CD/DVD then it is Machine specific as Neil stated.
    Sooo, what exact iMac is it, and what does it say on the CD/DVD?

  • HELP! I'm new at this and need some help getting started

    I am currently working on our website and was wondering how do I make a new page?
    for example.
    I want people to click on a link on the homepage to say a stockist list and see another page open with that information on.
    Also I need to know how to make the homepage have white strips on the left and right (for an example of what I mean please visit www.internationalrobes.com)
    I look forward to your replies!
    Carly

    Well, these are more web design related questions, but I will help as much as I can in the context.
    Going about adding a page:
    1) Navigate to Admin > Layout > Static pages
    2) Add a new static page here and enter your content
    3) Once it is saved, you should see an eyeglasses icon next to the page and you can copy that url and use it in a link.
    4) For example
    <a href="common/pagedetail.aspx?PageCode=test">My link here</a>
    As far as the white stripes, I think you mean centering a page?
    1) Edit the main master page under your theme
    2) Center the content using css, more info here: [http://www.thesitewizard.com/css/center-div-block.shtml]
    I think you would also benefit from the WebEx i created on implementing a layout into Webtools available here: [http://www.businessoneecommerce.com/developerdownloads/Implementing_a_Webtools_Theme.zip]

  • I´m new at flex and need some help.

    Hi, I’m in the last year of my University Degree and I
    was asked to develop a user friendly application to be used by
    teachers and students at the University. With this application,
    teachers will be able to post new projects with tight deadlines,
    and students will deliver their project files through the same
    application. The files will be saved in one of the University
    servers.
    I’ve downloaded the trial version of flex and I think
    it’s amazing. I want to suggest to the University to use flex
    2.0 to develop this application. I already know how to get data
    from the database using ASP/ XML. But I still have some doubts in
    my mind that maybe you guys can clarify.
    Can I send files with a flex application and store them in a
    specific directory in the server?
    Can I create a new directory in the same server?
    Can I add items to a database?
    Regards from Portugal

    Flex can upload files to a server.
    Flex can not create directories. Use Web Service,
    HTTPService, or RemoteObjects.
    Flex can not add items directly to a database. Use Web
    Service, HTTPService, or RemoteObjects.

  • I am getting a PostScript error and need some help

    I am trying to download an Illustrator file from my online class and am getting this message: %%[ Warning: PostScript error. No PDF file produced. ]%%. Is there a simple solution, I have done everything that I know how to do. I have installed Illustrator CS6 and uninstalled CS5 from my computer and I have Acrobat XI pro installed. Please help.

    It isn't clear what you are doing with this PostScript file. What are you doing, and where do you get the error?
    Also, are there any other lines of messages first, this isn't actually an error, just tells you there was one.

Maybe you are looking for

  • Wrong calculation of TDS (With holding Tax)

    Hi Gurus, I have matained TDS rates as follows - CA - 1%(Basic), CB - 0.1 (sucharge), CC - 0.022 (Edu. Cess), CD - 0.011 (Sec.Edu.Cess). I have assigned these same codes for some of the vendors. For all the vendors it is calculating TDS as rates main

  • Embedded Text - Animation problem

    Hi All, I'm having a strange problem with animated text and embedded fonts. The best way to explain is to show you... When I don't embed the font, the problem goes away. It happens in both IE and Firefox and on multiple machines. I've also tried diff

  • CSRFGuard failing to initialize in WebLogic 12c

    Hi, I am migrating a WebSphere based Web application to WebLogic. This web app uses Open Web Application Security Project (OWASP) CSRF (Cross-Site Request Forgery) framework to secure the application from hackers. This app works just fine under WebSp

  • How do I delete time back ups in time machine?

    I used to be able to go into time machine and delete individual back ups. Now nothing happens. Help.

  • How do i create a contact e-mail group from my e-mail address list?

    problem: don't know how to create an email group from my email list. 1. what are the steps to take so that I can create a group of 10 people that I can name and send emails to all at one click?