Question

Computer Science. Java programming language. Data Structures. 1) List all the nonprimitive types of data structures....

Computer Science. Java programming language. Data Structures.

1) List all the nonprimitive types of data structures.

2) Write a simple program for each of them (in Java)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

List all the nonprimitive types of data structures.

Ans: nonprimitive data types do not store a value but they store a reference to that value. Nonprimitive types in Java is

  1. Class
  2. Interface
  3. Array
  4. String
  5. Object

============================================================================================

2) Write a simple program for each of them (in Java)

//interface is the nonprimitive type
interface abc
{
   int a=12;
   void dis();
}
//bank class is nonprimitive type
class bank implements abc
{
   public void dis()
   {
       System.out.println("welcome");
   }
}
public class nonrefernceDataTypes {

   public static void main(String[] args) {
       // TODO Auto-generated method stub
      
       //ob object is nonprimitive type
       bank ob=new bank();
       ob.dis();
      
       //String s and array arr is nonprimitive type
       String s="welcome";
       int arr[]=new int[10];
   }

}

============================================================================================

Output

Add a comment
Know the answer?
Add Answer to:
Computer Science. Java programming language. Data Structures. 1) List all the nonprimitive types of data structures....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT