package keyword in java

The “package” keyword specifies the Java package in which the classes declared in a Java source file reside. Example package com.mycompany.services;   public class MyCompanyService { } package com.mycompany.services; public class MyCompanyService { } In the above example, the source file MyCompanyService.java must be placed under the package /com/mycompany/services Rules regarding the package statement A […]

Share this article on

return keyword in java

The “return” keyword causes a method to return to the method that called it, passing a value that matches the return type of the returning method. In other words, The return keyword is used to stop the execution of a method and return a value to the caller. Example return for a void method will […]

Share this article on
< Previous Next >