Discussions Q&R
I need help!
0 Vote
1 RéponseOutput of C++ code
0 Vote
2 Réponsespublic 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 Vote
2 Réponsesurgent java
0 Vote
2 Réponses"time is not defined"?
2 Votes
1 RéponseConstructor Error
1 Vote
2 RéponsesCan 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 Vote
8 Réponsescan 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 Vote
8 Réponseswhere's the error ?
-3 Votes
2 RéponsesObjects in heap?
0 Vote
1 RéponseAujourd'hui en vedette
Will i land a job
1 Votes
Hill Climbing
0 Votes
Course
1 Votes
Why we use return in function ?
0 Votes
someone helps how can i make two for loops over a 2d array in c ( i didn't learned pointers yet )
0 Votes
Leap year check
0 Votes