1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AveGali [126]
3 years ago
10

What is wrong in the following code? class TempClass { int i; public void TempClass(int j) { int i = j; } } public class C { pub

lic static void main(String[] args) { TempClass temp = new TempClass(2); } }
Computers and Technology
1 answer:
Rom4ik [11]3 years ago
7 0

Answer:

In the given program,  a parameterized constructor declaration is wrong, which can be described as follows:

Explanation:

Code:

class TempClass //defining class TempClass

{

   int i; //defining integer varaible i

   TempClass(int j)//defining parameterized constructor

   {

   i = j; //variable holds a value

   System.out.print(i); //print value

   }

}

public class Main //defining class Main

{

   public static void main(String[] aw) //defining main method

   {

       TempClass temp =new TempClass(2); //creating class Object and call parameterized constructor.

   }

}

Description:

  • In the given java code, two classes "TempClass and Main" is defined, inside the TempClass class an integer variable "i" and a parameterized constructor is declared, inside the constructor integer variable "i"  hold constructor parameter value, the use print method to prints its value.  
  • Then the main class is defined, inside this main method is declared, in this method, the TempClass object "temp" is defined, that call the parameter constructor.
You might be interested in
If you wanted a smartphone with the fewest restrictions on application development which smartphone operating system should you
Elodia [21]

Answer:

Apple iOS

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

Basically, softwares are categorized into two (2) main categories and these are;

I. Proprietary software: it's also known as a closed-source software and it can be defined as any software application or program that has its source code copyrighted and as such cannot be used, modified or distributed without authorization from the software developer.

II. Open-source software: it's a type of software in which end users are granted the permission to use, study, modify, copy and share the software with its source code anyhow.

An Apple iOS is an example of an operating system that has the open-source software features and as such its users are faced with minimal restrictions on application development.

This ultimately implies that, if you wanted a smartphone with the fewest restrictions on application development the smartphone operating system you should choose is Apple iOS.

3 0
3 years ago
Variables set equal to patterns are said to be:_______.
NemiM [27]

Answer:

b. instantiated.

Explanation:

In computer programming, to be instatiated or when variables are instatiated; this simply refers to the acts of making example out of a group variables or a form of template. For example in a situation of class of objects.

Hence, in this case, the correct answer to the question above is the option B, in which Variables set equal to patterns are said to be INSTATIATED

5 0
3 years ago
Lenny copied and pasted content from a commercial website into his research paper without citing his source, passing the work of
Sedbober [7]
Lenny might be either suspended
Or might be failed in that particular course
6 0
1 year ago
Pls answer 10 points ​
AlekseyPX

Answer:

1. C

5.b

Explanation:

1. Is c because it is in the short cut key

5. Is B because it is the last choice

3 0
2 years ago
Read 2 more answers
Hi can someone help me make a like a song for music Class pls I attached an example of what i need.
g100num [7]

Answer:

i dont really like music so sorry i cant help i hope someone can help you with this.

8 0
3 years ago
Other questions:
  • Which of the following is NOT one of the most important elements when designing a website?
    8·2 answers
  • Mass production usually uses an _______________ ____________ or production line technique.
    7·1 answer
  • Which of these is not a modifier?<br><br> short<br><br> unsigned<br><br> nest<br><br> long
    15·1 answer
  • The INC and Dec instruction do not effect the__________ flag
    6·1 answer
  • For this lab, you will work on a simple GUI application. The starting point for your work consists of four files (TextCollage, D
    5·1 answer
  • Write a MATLAB program to accomplish the following: Create two vectors, a and b, where vector a contains all positive integers l
    10·1 answer
  • Write a class Example() such that it has a method that gives the difference between the size of strings when the '-' (subtractio
    6·1 answer
  • What is cyber ethics​
    10·2 answers
  • Point out the wrong statement:
    7·1 answer
  • Lily obtained data from five trails 50 kcal 72 kcal 12 kcal and 50 kcal which best decribes her data
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!