Library Task

  1. create a class called – Library
  2. Have a main method in it
  3. Inside main method object creation instance called book
  4. using book reference call method read(300);
  5. In read (int pages)method return pages
  6. store return value as pa
  7. print pa in main method

package terminaltask;

public class Library {

public static void main(String[] args) {
    // TODO Auto-generated method stub

Enter fullscreen mode Exit fullscreen mode

Library book = new Library();
int pa = book.read(300);
System.out.println(pa);
}
public int read(int pages)
{
return pages;
}
}

out put –300

原文链接:Library Task

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容