discussion Java ( NEED IT TODAY)
Giving the following code snippet:
Discuss the reasons of using private access specifier in some places of the code and public in other places. Additionally, discuss how can you test this code.
public class Book
{
private String bookName;
private int ed;
private String author;
public Book (String n, int e, String a)
{
bookName = n;
ed = e;
author = a;
}
/**
* Gets the book name.
* @return the book name.
*/
public String getBookName()
{
return bookName;
}
/**
* Gets the book edition.
* @return the book edition.
*/
public int getBookEd()
{
return ed;
}
/**
* Gets the book author.
* @return the book author.
*/
public String getAuthor()
{
return author;
}
/**
* Prints the Book details.
*/
public void printBookDetails()
{
System.out.println("Book Name:" + getBookName() );
System.out.println("Book edition: " + getBookEd() );
System.out.println("Book Author: " + getAuthor() );
}
}
7 years ago 7
Purchase the answer to view it
- PublicandPrivateAccessSpecifiers.docx
Purchase the answer to view it
Purchase the answer to view it
- java-book-modifiers.zip
- A drug company is considering marketing a new local anesthetic
- Benefits of Business Analytics
- World View Chart
- What is network footprinting? What is network fingerprinting? How are they related?
- SCI 220 Week 2 Food Journal
- acc 568 week 1 dq 1>>>>>>>xoon only
- BUS330 Principles of Marketing Week 5 - Discussion 1 and 2
- SOC 490 - ASHFORD - Please don't message me just post the complete class.
- Assignment 4: Changing the AIS
- APPLICATION OF T-TEST IN RESEARCH