From cd49f0ebe3bd49572814c0733fbe7e13fa23003c Mon Sep 17 00:00:00 2001 From: 250406 <250406@localhost> Date: Thu, 20 Nov 2025 09:03:15 +0000 Subject: [PATCH] strings 2 --- pom.xml | 13 ++++++ .../java/com/mycompany/strings2/Strings2.java | 42 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/mycompany/strings2/Strings2.java diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6ddd341 --- /dev/null +++ b/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + com.mycompany + strings2 + 1.0-SNAPSHOT + jar + + UTF-8 + 24 + com.mycompany.strings2.Strings2 + + \ No newline at end of file diff --git a/src/main/java/com/mycompany/strings2/Strings2.java b/src/main/java/com/mycompany/strings2/Strings2.java new file mode 100644 index 0000000..61ab358 --- /dev/null +++ b/src/main/java/com/mycompany/strings2/Strings2.java @@ -0,0 +1,42 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.mycompany.strings2; + +import java.util.Scanner; + +/** + * + * @author 250406 + */ +public class Strings2 { + + public static void main(String[] args) { +// conversão entre tipos de dados +// conversão de um tipo de dado para String +// String.valueOf(valorAConverter); +// conversão de String para int +// Integer.parseInt(stringAConverter) +// conversão de String para double +// Double.parseDouble(stringAConverter) +// conversão de String para float +// Float.parseFloat(stringAConverter) +// conversão de String para long +// Long.parseLong(stringAConverter) + Scanner scanner = new Scanner(System.in); + System.out.println("Introduza um numero"); + String numero = scanner.nextLine(); + int numeroInteiro = Integer.parseInt(numero); + double numeroDouble = Double.parseDouble(numero); + + for(int i = 0; i < 11; i++){ + System.out.println(i); + + } + for(int i = 10; i > 0; i--){ + System.out.println(i); + } + + } +}