questions for Java

are character 2 and integer 2 represented by the same sequence of 0s and 1s?

what is a resudent program ?

(in simple english) What is a class?

After the execution of the code segment shown below, what value will x hold and what value will y hold?

int x = 1;

int y;

y = x;

y = 2;

After the execution of the code segment shown below, will x and y refer to the same

object or different objects?

BankAccount x = new BankAccount("A10", "Smith");

BankAccount y;

y = x;

y.deposit( 100 );

a) What are the differences between a Java applet and a Java stand-alone application

program?

b) Suppose an applet is being displayed.

i) If we resize the applet, the init method will be called as a result of the action. Is

this true or false?

ii) If we resize the applet, the paint method will be called as a result of the action.

Is this true or false?

The following code reads in the duration of an event in seconds. Complete the code to display

the duration in days, hours, minutes, and seconds. As an example, if the user enters the value

3750 (= 3600 + 120 + 30), the output should be:

The event lasts 0 days 1 hours 2 minutes and 30 seconds

(Assume that the user input is always a valid integer.)

import java.io.*;

public class Convert

{

public static void main(String [] args) throws IOException

{

BufferedReader keyboard = new BufferedReader(

new InputStreamReader(System.in));

System.out.print("Enter the duration of the event " +

"in seconds: ");

int duration = Integer.parseInt(keyboard.readLine());

int days;

int hours;

int minutes;

int seconds;

Write an applet that displays the number of mouse clicks. Initially it displays 0, and then

increases the number by 1 each time the user clicks the mouse on the applet.

Note: The MouseListener interface has the following methods:

public void mouseClicked(MouseEvent e)

public void mouseEntered(MouseEvent e)

public void mouseExited(MouseEvent e)

public void mousePressed(MouseEvent e)

public void mouseReleased(MouseEvent e)

[2253 byte] By [banjamima] at [2007-10-2 22:06:26]
# 1
What is a class - a blue print of an object - a general description containing the actions an object can do/take (methods)After the execution of the code segment shown below, what value will x hold and what value will y hold?x = 1y = 2
imtireda at 2007-7-14 1:23:07 > top of Java-index,Java Essentials,New To Java...
# 2

What is this? Some sort of assignment you want to get solved for you? As those are many questions related to VERY basics, I would recommend that you either get a good book (I personally liked the Core Java books as I started with Java) and/or browse the Java tutorials and other documentation before you post such questions.

This way, the learning effect is much higher than with just copying answers from others...

To start with, I'll provide you the answer for the first question:

are character 2 and integer 2 represented by the same sequence of 0s and 1s?

- The answer is NO. char c = '2' in binary reads 110010, where int i = 2 reads 10.

falke2203a at 2007-7-14 1:23:07 > top of Java-index,Java Essentials,New To Java...