



Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
Introducción a java cosas muy simples
Tipo: Apuntes
1 / 6
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!




First marking period Page 1 de 6
Java is a programming language and a platform. Java is a high level, robust, secured and object-oriented programming language. Platform : Any hardware or software environment in which a program runs, is known as a platform. Since Java has its own runtime environment (JRE) and API, it is called platform.
According to Sun, 3 billion devices run java. There are many devices where java is currently used. Some of them are as follows: Desktop Applications such as acrobat reader, media player, antivirus etc. Web Applications Enterprise Applications such as banking applications. Mobile Robotics Games. AREA: Computer Science TOPIC: (^) Java Introduction GRADE: 10 TEACHER: Mr. Diego Tovar DATE: From: To: STUDENT NAME:
First marking period Page 2 de 6 Types of Java Applications There are mainly 4 types of applications that can be created using java programming:
First marking period Page 4 de 6 Java Example Let's have a quick look at java programming example. import javax.swing.JOptionPane; class Simple{ public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Hello World!!"); } } Understanding first java program Let's see what is the meaning of class, public, static, void, main, String[], System.out.println(). import javax.swing.JOptionPane; a library imported so the JOption statement can work. class keyword is used to declare a class in java. public keyword is an access modifier which represents visibility, it means it is visible to all. static is a keyword, if we declare any method as static, it is known as static method. The core advantage of static method is that there is no need to create object to invoke the static method. The main method is executed by the JVM, so it doesn't require to create object to invoke the main method. So it saves memory. void is the return type of the method, it means it doesn't return any value. main represents startup of the program. String[] args is used for command line argument. JOptionPane.showMessageDialog() is used as a print statement.
A variable is a word or a letter used to hold values or expressions, for example: x=5, y=6, z=x+y. Java variables are used to hold values or expressions. A variable can have a short name, like “x”, or a more descriptive name, like “ carname ”: Rules for Java variable names: Variable names are case sensitive (y and Y are two different variables) Variable names must begin with a letter or the underscore character Variables Can’t contain spaces nor special characters
First marking period Page 5 de 6
Creating variables in Java is most often referred to as " declaring " variables. To use any variable in a Java program, you must first declare it. Variable declarations consist of: type variablename;
public static void main(String[] args) { double n, d; n=Double.parseDouble(JOptionPane.showInputDialog("Please enter a number")); d=n*2;