Results 1 to 2 of 2
  1. #1
    Sri Vidhya is offline Member
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Default where did i go wrong?

    class sleepin{
    public boolean sleeping(boolean weekday, boolean vacation){
    if(weekday==false && vacation==false)
    return true;
    if(weekday==true && vacation==false)
    return false;
    if(weekday==false && vacation==true)
    return true;
    }}


    public class java2{
    public static void main(String [] args){
    sleepin sleep=new sleepin();
    sleep.sleeping(args[0],args[1]);
    }}

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Java Code:
    C:\jexp>javac sleepin.java
    sleepin.java:15: sleeping(boolean,boolean) in SleepIn cannot be applied to (java.lang.String,java.lang.String)
            sleep.sleeping(args[0], args[1]);
                 ^
    1 error
    Type mismatch.
    Java Code:
    class SleepIn{
        public boolean sleeping(boolean weekday, boolean vacation){
            if(weekday==false && vacation==false)
                return true;
            if(weekday==true && vacation==false)
                return false;
            if(weekday==false && vacation==true)
                return true;
            return false;
        }
    
        public static void main(String[] args){
            if(args.length > 0)
                System.out.println(args[0].getClass().getName());
            SleepIn sleep=new SleepIn();
    //        sleep.sleeping(args[0], args[1]);
            sleep.sleeping(Boolean.valueOf(args[0]).booleanValue(),
                           Boolean.valueOf(args[1]).booleanValue());
        }
    }

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2013, 02:37 AM
  2. What am I doing wrong??
    By NoNickName in forum New To Java
    Replies: 3
    Last Post: 04-24-2009, 12:04 AM
  3. what am i doing wrong here??
    By tornbacchus in forum New To Java
    Replies: 19
    Last Post: 04-16-2009, 04:54 AM
  4. what's wrong?
    By rayda in forum New To Java
    Replies: 3
    Last Post: 04-14-2009, 10:07 PM
  5. Can someone tell me what I did wrong??
    By booter4429 in forum New To Java
    Replies: 7
    Last Post: 08-13-2008, 09:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •