Explore BrainMass

Programming Exercise

Write a function that includes the following sequence of statements:

x = 21;
int x;
x = 42;

I need to run the program in C, C++, and JAVA. If I can get started in one of the languages I will be able to complete the rest. Thanks.

© BrainMass Inc. brainmass.com June 20, 2018, 10:47 pm ad1c9bdddf

Solution Preview

Following is the method in Java:

public int myMethod(int x)
x = 21;
x = 42;
return x;

It will ...