Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Integer Operations | Primitive Data Types
Java Data Types

bookChallenge: Integer Operations

Taak

Swipe to start coding

Write a program that does the following:

  • Hardcode two integers in your program.
  • Add the two integers.
  • Print the sum to standard output.
  • If the sum overflows the range of a 32-bit signed integer, print Warning: Integer overflow instead of the sum.

The entry point is the main method of the Main class in the com.example package.

Notes:

  • Do not use any input functionality.
  • The valid range for a 32-bit signed integer is from -2147483648 to 2147483647.

Oplossing

solution.java

solution.java

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 3
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

Awesome!

Completion rate improved to 7.14

bookChallenge: Integer Operations

Veeg om het menu te tonen

Taak

Swipe to start coding

Write a program that does the following:

  • Hardcode two integers in your program.
  • Add the two integers.
  • Print the sum to standard output.
  • If the sum overflows the range of a 32-bit signed integer, print Warning: Integer overflow instead of the sum.

The entry point is the main method of the Main class in the com.example package.

Notes:

  • Do not use any input functionality.
  • The valid range for a 32-bit signed integer is from -2147483648 to 2147483647.

Oplossing

solution.java

solution.java

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 3
single

single

some-alt