De cara a las clases y prácticas de programación de clientes/servidores TCP/IP en Java es conveniente que refresquemos lo que ya conocemos. Revise (en medida de sus necesidades) los siguientes ejemplos: entienda cómo funcionan, consulte el manual de aquellas funciones que desconozca y pruebe a ejecutar y modificar partes de los programas.
Notas:
- Si no sabe por donde empezar, y no entiende ni el primer ejemplo, le recomiendo que empieze por este pequeño tutorial http://www.loirak.com/prog/java.php
- El manual para consulta de funciones Java le recuerdo que está disponible en: http://docs.oracle.com/javase/6/docs/api/
- Tiene disponible otra documentación, tutoriales y ejemplos en la web oficial http://docs.oracle.com/javase/tutorial/index.html. En particular empiece por http://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html


  1. Writing Hello World Java program
    In this lesson we will learn how to write, compile and test the Hello World java application.

  2. Understanding Hello World Java Program
    In this lesson we will understand the Hello World Java program.
  3. Comparing Two Numbers
    This is a very simple example of Java that teaches you the method of comparing two numbers and finding out the greater one. First of all, name a class "Comparing" and take two numbers in this class. Here we have taken a=24 and b=25, now we have to find out whether a=b, a>b or b>a.

  4. Determining the largest number
    This example of Java programming will teach you the coding for determining the largest number amongst three. Here we have taken three integers as x = 500, y = 70 and z = 3000.


  5. Preparing table of a number by using loop

    This tutorial will teach you the methods of preparing the table of a given number by using loop condition. As we know the loop statements are used to repeat a statement or process multiple times according to a specified condition.

  6. Exception Handling in Example
    Exception, that means exceptional errors. Actually exceptions are used for handling errors in programs that occurs during the program execution.

  7. Java Identifier Example
    In this example you will learn what is identifier and primitive data type of a identifier. This tutorials will teach you how to use these identifier in you java programming.

  8. Java - Variable, Constant and Literal in Java
    Variable : You can assign the values to the variable once it has been declared. The values of the variable can be changed anywhere in the program if the variable is accessible in that scope. In this example we have used the variable intvariable to illustrate this.

  9. Java Read File Example
    In the section of Java Tutorial you will learn how to write java program to read file line by line. We will use the DataInputStream class to Read text File Line by Line.

  10. Java Write to File Example
    In the section of Java Tutorial you will learn how to write java program to write to a file.

  11. Java Word Count Example
    This example illustrates how to count the number of lines, number of words and number of characters in the specified file. Program takes the file name as parameter and it counts the number of words and lines present in the file.
  12. Boolean Expression in Java
    In this example you will see that how the expression returns a boolean value which is either true or false. This example illustrates you how to make a boolean expression by using relational operators and how to use the returned value of the expression.
  13. String Buffer Example
    In this example you will learn about StringBuffer class. This example explains how you can use functions provided by the StringBuffer class like append, insert, reverse, setCharAt, charAt, length, deleteCharAt, substring, delete, capacity etc. to manipulate the string operation in your program.

  14. Type Casting Example
    This example illustrates that what is type casting? Type Casting refers to changing an entity of one datatype into another. This is important for the type conversion in developing any application.

  15. Java - Array in Java
    Array: Array is the most important thing in any programming language. By definition, array is the static memory allocation. It allocates the memory for the same data type in sequence. It contains multiple values of same types.

  16. length() method in Java
    In this section, you will learn how to use length() method of the String class. We are going to using length() method.

  17. Java - Break statement in java
    Break: The break statement is used in many programming languages such as c, c++, java etc. Some times we need to exit from a loop before the completion of the loop then we use break

  18. Java - Continue statement in Java
    Continue: The continue statement is used in many programming languages such as C, C++, java etc. Sometimes we do not need to execute some statements under the loop then we use the continue statement that stops the normal flow of the control and control returns to the loop without executing the statements written after the continue statement.

  19. Java - The switch construct in Java
    Switch is the control statement in java which also turns the normal flow control of the program as per conditions. It works same as If-Else construct. This is the difference between Switch and If-Else construct that switch is used for reduce the if statements.

  20. Switch Statement example in Java
    This is very simple Java program for implementing the switch statement. Here, you will learn how to use the switch statement in your java program for developing java application.

  21. While Loop
    Loop is the control statement of any language in which whenever you want to perform the repetitious work then you use the Loop control statement.

  22. do-while Loop in Java
    In some conditions in java, you need to run some statements and processes once at least. For that you have to use the do while loop in after that check the condition then we use the do-while loop statement.

  23. For Loop in Java
    The for loop is the type of looping construct. It also works as while loop construct but it provide the initialization, condition and the increment is same written in the for construct.
  24. Reading a File into a Byte Array
    In this program we will read a file in the form of a byte array. We can do it very easily. Firstly we will create an object of File class and pass the name of the file which we want to read, in the constructor of File class. We will use DataInputStream to read primitive data types.

  25. String Buffer insert and append example
    In this section, you will learn how to insert StringBuffer and append data. The StringBuffer is a class that implements multiple sequence of characters. The following program construct a string buffer that has '0' capacity.

  26. Combine String example
    In this section, you will learn how to combine or merge two strings in java. The java.lang package provides the method that helps you to combine two strings and making into single string.

  27. Passing Command Line Arguments
    In this example we are going to learn how we can pass values on command line argument .

  28. Runtime Exec Example
    In this example we are going to execute an application using java program.

  29. DateExample
    In this section we are discussing about the specific date using the Date class object, retrieving milliseconds from the Date object, elapsed time, date contained in the Date object before and after it has change and displaying both the values on the console.

  30. Auto Increment and Decrement
    In this example we are demonstrating the significance of prefix and postfix operators by incrementing and decrementing the value of a variable that how both are different with each other.

  31. Randomizer
    In this example we are discussing how to generate the random numbers by using the random() method of the Math class and change them into different random numbers by apply some mathematical operations onto them and display 10 random numbers on the console

  32. Check Empty String
    In this example we are checking a sting object containing empty or null value. Apache has provided two methods isBlank() and isNotBlank() for checking the strings.
  33. Java String Split Example
    In this section, you will learn how to split string into different parts using spit() function.

Última modificación: jueves, 19 de enero de 2017, 10:57