Happy Coding

How to fix this error in java code

class Solution {
public int trap(int[] height) {

    int left = 0, right = height.length  - 1;
int ans = 0;
int left_max = 0, right_max = 0;
while (left < right) {
    if (height[left] < height[right]) {
        height[left] >= left_max ? (left_max = height[left]) : ans += (left_max - height[left]);
        ++left;
    }
    else {
        height[right] >= right_max ? (right_max = height[right]) : ans += (right_max - height[right]);
        --right;
    }
}
return ans;
}

}

What error are you getting?

What line is it on?

Have you tried breaking those complicated lines down into smaller individual steps?