Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Implement Octet Class from Septet Class in Java using JavaTuples
At first create Septet and add elements −
Septet<String, String, String, String, String, String, String> septet = new Septet<String, String, String, String, String, String, String>( "Laptop", "Desktop", "Tablet", "Notebook", "Phone", "Reader", "LCD");
Now, implement Octet from Septet −
Octet<String, String, String, String, String, String, String, String>
octet = septet.add("LED");
Following is an example to implement Octet class from Septet class in Java −
Example
import org.javatuples.Septet;
import org.javatuples.Octet;
public class MyDemo {
public static void main(String[] args) {
Septet<String, String, String, String, String, String, String>
septet = new Septet<String, String, String, String, String, String, String>(
"Laptop", "Desktop", "Tablet", "Notebook", "Phone", "Reader", "LCD");
System.out.println("Septet elements = " + septet);
Octet<String, String, String, String, String, String, String, String>octet = septet.add("LED");
System.out.println("Octet (implemented from Septet) = " + octet);
}
}
Output
Septet elements = [Laptop, Desktop, Tablet, Notebook, Phone, Reader, LCD] Octet (implemented from Septet) = [Laptop, Desktop, Tablet, Notebook, Phone, Reader, LCD, LED]
Advertisements