- create a class called - Library
- Have a main method in it
- Inside main method object creation instance called book
- using book reference call method read(300);
- In read (int pages)method return pages
- store return value as pa
- print pa in main method
package terminaltask;
public class Library {
public static void main(String[] args) {
// TODO Auto-generated method stub
Library book = new Library();
int pa = book.read(300);
System.out.println(pa);
}
public int read(int pages)
{
return pages;
}
}
out put --300
The above is the detailed content of Library Task. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn