cout << joystick2X << endl;
You can look at the console using rioLog in Eclipse or the console log viewer on the driver' station. (click the gear above the log window on the right and select "View Console")
You could also put the value on the smart dashboard:
SmartDashboard:

utNumber(joystick2x)
Then switch the driver station to smart dashboard.