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]
4 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]4 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
What are Boolean​ connectors? A. sites that connect you to more information on your topic B. databases that link your topic to a
Gala2k [10]

A,B,C AND D.  All depend on end user uses.

A. sites that connect you to more information on your topic

B. databases that link your topic to available sources

C. indexes on connective materials

D. shortcuts to help you narrow the search field

<u>Explanation:</u>

Boolean connectors are nothing but Boolean operators such as AND, OR, NOT, XOR,IMP, ISNOT , “=”, “>=”, “<>”,”<=” extra.

It all depends up how the end user uses in the programming languages. Normally if Boolean connector returns true value, instruction or set of instruction are used to execute for next core of action in the programming language.

Mostly in any programming language relation operators such as “=”, “>=”,”<=”,” <>” extra with his combination add on logical operators are used such as “And”, “OR” and “NOT” extra.

3 0
3 years ago
Favorite friends character and why GO!
Masteriza [31]
Rachel Def i really don’t know just cause
7 0
3 years ago
Read 2 more answers
8.5 Edhesive Code Practice
Lynna [10]

Answer:

Check explanation

Explanation:

#Print original quote

twainQuotes = ["I have never let my schooling interfere with my education.",

"Get your facts first, and then you can distort them as much as you please.",

"If you tell the truth, you don't have to remember anything.",

"The secret of getting ahead is getting started.",

"Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]

print(twainQuotes)

#Sort and print

twainQuotes.sort()

print(twainQuotes)

#Insertion of quote, sort, then print

twainQuotes.extend(["Courage is resistance to fear, mastery of fear, not absence of fear."])

twainQuotes.sort()

print(twainQuotes)

mark as brainliest pls hehe

8 0
3 years ago
How to get a satellite image of something or someplace?
iogann1982 [59]
You go onto google maps and type the name in 
5 0
3 years ago
What's a pfp? I keep seeing it on scratch
HACTEHA [7]
A pfp is a Profile-Picture can I pls have brainliest
3 0
3 years ago
Read 2 more answers
Other questions:
  • Which statement correctly describes how the density and temperature of air is related .
    7·1 answer
  • Largest operating expenses include
    7·1 answer
  • What are the TWO methods of copying and pasting on the AutoCAD Clipboard function?
    7·1 answer
  • Write a program that declares constants to represent the number of inches, feet, and yards in a mile. Name the constants INCHES_
    6·1 answer
  • If you were investigating login issues on a Windows computer, which portion of the Event Viewer logs would be a good place to st
    7·1 answer
  • Match the categories in the first column with examples in the second column.
    14·1 answer
  • When you purchase an item in a store, you may be charged __________.
    11·2 answers
  • In object-oriented programming, the object encapsulates both the data and the functions that operate on the data.
    10·1 answer
  • Every time attribute A appears, it is matched with the same value of attribute B, but not the same value of attribute C. Therefo
    11·1 answer
  • In MS Word we can merga cells true or false​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!