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
Can someone URGENTLY help me with my java code (I WILL GIVE BRAINLIEST)!? Ive been working on it for hours and its not working!
vovikov84 [41]

Answer:

Private ListNode intel size

7 0
2 years ago
Does any body know how to bypass easy anti cheat on crossout
dolphi86 [110]

Answer:

It is very hard as easy anticheat is the leading anticheat right now, you can do some web surfing and maybe find out.

6 0
2 years ago
How is AI used in racing ?
NikAS [45]
This now allows human pilots to race together with AI drivers. The AI driver is, in this case, the intelligent software that gathers all data from the sensors and other touchpoints to drive the car.
3 0
2 years ago
Zola is very skilled with Microsoft and Apple, and she knows different methods of programming. This knowledge will help make Zol
hammer [34]
I believe programmer would be your answer! If there is a multiple choice, please tell me in the comments of this answer!
3 0
3 years ago
Read 2 more answers
When you declare a variable of a basic, primitive type, such as int x = 10;, the memory address where x is located holds the ___
Nadya [2.5K]

Answer:

Answer is (d) value of 10

Explanation:

Usually when we write "int x=10;", a memory space is allocated for an integer variable with name x, and content 10.

8 0
2 years ago
Read 2 more answers
Other questions:
  • You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will
    12·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·2 answers
  • In this context, the word “session” refers to _____.
    5·2 answers
  • Which industry has the highest employment figure for both teen and young adults in July, 2014?
    6·1 answer
  • You are attempting to upgrade a Windows Server 2008 R2 server to Windows Server 2016 Standard. What must be done in order to acc
    5·1 answer
  • What is are motor vehicle emissions?
    8·1 answer
  • Ladders are a fundamental piece of equipment on construction sites and employers are expected to ensure that workers follow safe
    5·1 answer
  • What is one purpose of an essay’s conclusion paragraph?
    13·1 answer
  • The HTTP protocol operates at which layer?
    7·1 answer
  • When the CPU performs the work described in the commands,
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!