Discussioni Q&A
I need help!
0 Voti
1 RispostaOutput of C++ code
0 Voti
2 Rispostepublic class Vehicle {
int maxSpeed;
int wheels;
String color;
double fuelCapacity;
void horn() {
System.out.println("Beep!");
}
}
class MyClass {
public static void main(String[ ] args) {
Vehicle v1 = new Vehicle();
Vehicle v2 = new Vehicle();
v1.color = "red";
v2.horn();
System.out.println(v1);
}
}
Explain its outcome. I am unable to get the last line of outcome.
-1 Voto
2 Risposteurgent java
0 Voti
2 Risposte"time is not defined"?
2 Voti
1 RispostaConstructor Error
1 Voto
2 RisposteCan someone explain this code to me....
class ReverseNumberDemo
{ public static void main(String args[]) {
int num=123456789;
int reversenum =0;
while( num != 0 ) {
reversenum = reversenum * 10;
reversenum = reversenum + num%10;
num = num/10; }
System.out.println("Reverse of specified number is: "+reversenum);
}
}
the thing I don't get is the reversenum part......isn't reversenum=0 so wouldn't reversenum*10=0
0 Voti
8 Rispostecan anyone plz explain me this program step by step?#include <iostream>
using namespace std;
class MyClass {
public:
int var;
MyClass() { }
MyClass(int a)
: var(a) { }
MyClass operator+(MyClass &obj) {
MyClass res;
res.var= this->var+obj.var;
return res;
}
};
int main() {
MyClass obj1(12), obj2(55);
MyClass res = obj1+obj2;
cout << res.var;
}I am not getting the part inside operator+
0 Voti
8 Rispostewhere's the error ?
-3 Voti
2 RisposteObjects in heap?
0 Voti
1 RispostaPopolare oggi
Coding for Cybersecurity
1 Votes
Need help
1 Votes
Pointers in c#
1 Votes
Salut tout le monde
1 Votes