Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question1: answer the following in object operating programming :- A.Tell whether the following piece of code is valid or not? if not, tell the reason

Question1: answer the following in object operating programming :-

A.Tell whether the following piece of code is valid or not? if not, tell the reason also.

class Super { ... public void superToSuper(Super anotherSuper){ int i = anotherSuper.public_Super_Field; int j = anotherSuper.protected_Super_Field; int l = anotherSuper.private_Super_Field; } ... } class Sub extends Super { ... public void subToSub(Sub anotherSub){ int i = anotherSub.public_Sub_Field; int j = anotherSub.protected_Sub_Field; int k = anotherSub.private_Sub_Field; int l = anotherSub.public_Super_Field; //inherited int m = anotherSub.protected_Super_Field; //members int n = anotherSub.private_Super_Field; } ... }

B. Consider that following is the definition of an interface:

interface Callback { void callback(int param); }

Depict how the class Client implement this interface

C. How a thread can be suspended, resumed and stopped by using a flag variable

D.How monitor help in synchronization?

E.There are three threads T1, T2, and T3? How do you ensure sequence T1, T2, T3 in Java?

F.What is multicasting or multicast transmission? Which Protocol is generally used for multicast? TCP or UDP?

G.Write the missing Code?

import java.______; import java.______; class Whois { public static void main(String args[]) throws Exception { int c; // Create a socket connected to internic.net, port 43. Socket s = new Socket("internic.net", 43); InputStream in = _____ getInputStream(); OutputStream out = s.getOutputStream(); // Construct a request string. String str = (args.length == 0 ? "osborne.com" : args[0]) + " "; byte buf[] = str._________(); // Convert to bytes. out.write(buf); // Send request // Read and display response. while ((c = in.read()) != -1) { System.out.print((char) c); } s.close(); } }

H.How to implement an applet into a web page using applet tag?

I.Explain how to implement an applet into a web page using applet tag?

J.How to implement an applet into a Java program?

K.Explain how to set the background color within the applet area?

L.What are the methods that control an applets on-screen appearance?

M.Explain how to play sound in an applet?

N.Write the missing code in the following applet.

import java.awt.*; import java.applet.*; public class SimpleApplet ________________ { public void paint(Graphics g) { _______drawString("A Simple Applet", 20, 20); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

Demonstrate how to use the Gaps Model for diagnosing and

Answered: 1 week ago