Ce document est une leçon pour débuter la programmation en Java, suivie d'exercices d'application.
[...] //PROGRAM-1: Program to demonstrate "System.out.println" and COMMENTS public class HelloWorld{ //Class name public static void main(String main method System.out.println("Hello World"); print on screen } } //PROGRAM-2:Program to demonstrate "System.out.println" with two messages public class HelloWorld{ public static void main(String System.out.println("Hello World" + " I am new to Java"); } } //PROGRAM-3:Program to demonstrate different datatypes, giving values, and printing variables. public class DataTypesExamples{ public static void main(String int n1; n1 = Assignment float n2 = 3.85f; //Initialization double result=1469.05962; final double Pi=3.1415926535; //constant char String w="What"; System.out.println("n1=" + System.out.println(n2); System.out.println(result); System.out.println(Pi); System.out.println(w + } } Exercises: 1. Write a Java program to print your name and your university ID in two lines Write a Java program to define an integer and a float numbers, and use assignment and initialization to give values. Then, print the variables. [...]
Source aux normes APA
Pour votre bibliographieLecture en ligne
avec notre liseuse dédiée !Contenu vérifié
par notre comité de lecture