Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Explain why we need to use a type cast in this Java code, when we wouldn't have to in C++. int myNum; long anotherNum;

1. Explain why we need to use a type cast in this Java code, when we wouldn't have to in C++.

int myNum; long anotherNum; myNum = (int)anotherNum + 1;

2. Explain the difference between primitive type variables and class type variables. After you explain, declare two variables: one primitive and one class type.

3. In addition to single line (//) and multi line (/* */) comments (that we had in C++), Java adds a third type. What is it called, how does it look different, and why would you use it?

4. What happens if you forget to put System.exit(0); at the end of a program that uses dialog boxes? Is it safer then, and a best practice, to put it at the end of every Java program? Why or why not?

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions