Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Integer Operations | Primitive Data Types
Java Data Types

bookChallenge: Integer Operations

Завдання

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.

Рішення

solution.java

solution.java

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 3
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

Awesome!

Completion rate improved to 7.14

bookChallenge: Integer Operations

Свайпніть щоб показати меню

Завдання

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.

Рішення

solution.java

solution.java

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 3
single

single

some-alt