Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Debugging a Broken Program | Safe File Operations and Debugging
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# Exceptions and Error Handling Practice

bookChallenge: Debugging a Broken Program

Tarefa

Swipe to start coding

You are given a program that attempts to read the contents of a file and print them to the console. However, if the file does not exist, the program throws an exception and crashes. Your task is to fix the program so that it handles the missing file gracefully and no longer crashes when the file is absent.

  • Return "File does not exist." if the file at the given path is missing.
  • Otherwise, return the contents of the file.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookChallenge: Debugging a Broken Program

Deslize para mostrar o menu

Tarefa

Swipe to start coding

You are given a program that attempts to read the contents of a file and print them to the console. However, if the file does not exist, the program throws an exception and crashes. Your task is to fix the program so that it handles the missing file gracefully and no longer crashes when the file is absent.

  • Return "File does not exist." if the file at the given path is missing.
  • Otherwise, return the contents of the file.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
single

single

some-alt