Sunday, February 1, 2015

Assignment on Conditional Statements, loops and variables

1. Store numbers from 1000 to 1010 in an array and find out the numbers which are divisible by 3.

2.  Store some 10 sentences in a string array. If the length of the string is more than 10 , then print that string. Else print a message as "Not proper sentence".

3. Create a method to display the values from a array only if the array size is >0. The array size should be displayed at any condition (Even if the array is 0 size, print the array size before exiting the loop.

4. Create a String with a sentence "JOHN COMPLETED HIS COURSE WITH DISTINCTION". Create a parent class with a method to concatenate "AND HE JOINED NEW COURSE".

Same method should be overridden with the concatenation of "HE JOINED A NEW JOB". Use static variable.

No comments:

Post a Comment