Java User Defined Methods

Back To Java Index


1. program to demonstrate user defined function,create a function to display hello world on the screen - Code
2. program to create a function that checks whether a number is even or odd (number is passed to function as argument) - Code
3. program to find create a function to check whether a number passed to it as argument is prime or not - Code
4. program to create a function that prints the table of the number passed to it as argument - Code
5. program to create a function that takes two integers arguments and calculates their sum - Code
6. program to create a function that takes two integer arguments calculates difference between them - Code
7. program to create a function that inputs two numbers and finds their product - Code
8. program to create a function that takes three integer arguments and calculates their sum - Code
9. program to create a function that takes two integer arguments and finds largest of them - Code
10. program to create a function that takes three integer arguments and finds largest of them - Code
11. program to create a function that takes three integer arguments and finds smallest of them - Code
12. program to create two functions to calculate area and perimeter of rectangle (length and breadth of rectangle are passed to functions as arguments) - Code
13. program to create two functions that find area and circumference of circle (radius of circle is passed to functions as argument) - Code
14. program to create two functions to find area and perimeter of square (side of square is passed to functions as argument) - Code
15. program to create a function that finds volume of a box (width, depth and height of box are passed to function as arguments) - Code
16. program to create a function that check whether character passed to it as argument is vowel or not using switch case statement - Code
17. program to create a function that calculates sum of numbers between two numbers a and b (a nd b are passed to function as integer arguments ) - Code
18. program to create two functions that prints the three numbers in ascending order and descending order passed to functions as arguments - Code
19. program to create two functions that prints sum of even numbers and odd numbers between two numbers a and b (a nd b are passed to functions as integer arguments ) - Code
20. program to create a function to calculate simple interest based on principal amount,rate of interest and time (principal,rate and time are passed to functions as arguments, principal and rate are passed as float arguments , time is passed as integer argument ) - Code
21. program to create a function that computes discount based on price entered by the user (price is passed to function as integer argument , if price is greater than or equal to 1000, discount is calculated as 10 percent else 5 percent ) - Code
22. program to create a function that display hello world for a specified number of times - Code
23. program to create a function that returns factorial of a number passed to it as argument - Code
24. program to create a function that returns 1 if number passed to it is prime and returns 0 if number passed to it is not prime - Code
25. program to create a function that returns area of circle based on radius passed to function as argument - Code
26. program to create a function that returns sum of numbers between a and b passed to function as integer arguments - Code
27. program to create a function that returns largest of three numbers passed to it as arguments - Code
28. program to create a function that returns smallest of three numbers passed to function as integer arguments - Code
29. program to create a function that returns volume of box based on width,depth and height passed to function as integer arguments - Code
30. program to create a function that finds yearly salary based on monthly salary passed to function as integer argument - Code
31. program to create a function that calculates compound interest based on principal amount, rate of interest and time passed to the function as arguments - Code