Advanced Search

Results 1 to 2 of 2

Thread: char vars may inserted as method parameters ?

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default char vars may inserted as method parameters ?

    char vars may inserted as method parameters ?
    int setAAA (int varAAA) {...} the first int in a setter is error ?
    void is required whereas we have no return data ?
    char vars may compared with == or need...?
    constructors may output text ? but no return data ?
    why does not compile the below:

    Code:
    class Test2
    {
    public static void main(String[] args)
    {
    char grade = 'A';
    
    int process(char grade)
    {
    int points = (grade == 'A' ? 4 : 3);
    return points;
    }
    
    System.out.println(process(grade));
    
    }
    }

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    Code:
    class Test2
    {
    	public static void main(String[] args)
    	{
    		char grade = 'A';	
    		System.out.println(process(grade));
    	}
    	private static int process(char grade)
    	{
    		int points = (grade == 'A' ? 4 : 3);
    		return points;
    	}
    }

  3. The Following User Says Thank You to techietim For This Useful Post:

    leonidassavvides (08-25-2009)

Bookmarks

Posting Permissions

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