One of the programming languages \u200b\u200bthat always caught my attention is
JAVA
for portability and is also multi pltaforma.
is why in this section I'll upload all my progress in this language ... not promise much as I am starting from scratch.
will use Java in Ubuntu 8.04 in a graphical environment to see how to install XFaces java visit the following link in this block (JDK on Linux Installing
) Creating our first program (Hello World)
NOTE: Save file with the same name and extension class. java ( HelloWorld . java) Compile javac
holaMundo.java
run java HelloWorld
(always follow this sequence with all the examples)
/ * First year of Java
http : / / geekslinuxchile.blogspot.com / Author: Jorge Lara Cravero * /
import javax.swing .*; public class HelloWorld {public static void main (String [] args) { String message = "Hello World"; JOptionPane.showMessageDialog (null, message, "Hello, World!" JOptionPane.INFORMATION_MESSAGE) System . exit (0);
}}
This second script looks for a letter or word in a string
Include the class Input / * Jorge Lara Cravero
http://geekslinuxchile.blogspot.com/ * /
{public class
seek public static void main (String args []) {
Input data = new Input ();
(".... Enter string System.out.println ....") ;
dato.getValue letters = String ();
sentence ...."); System.out.println (".... Enter
dato.getValue String phrase = ();
String output = "is at index "+ letras.indexOf (sentence); System.out.println (output);
}}
code runs as follows:
If
note I wrote
Jorge Lara and I find the word in lower case
lara
Obviously Lara! = lara
Note: images correspond to a more complete code because if you review the example all the console will addition if you want your system says it is not! should be made a condition if - else considering that when the word is not the system will throw a -1
would be something like int a = letras.indexOf (sentence); if (a == -1 ) guess what happens
guess what else happens
x Jlara
0 comments:
Post a Comment