This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
/** | |
* This is the customary 'Hello World' in Java. | |
* When we run a Java class, it's main method os invoked. This has to be | |
* a public static method which takes an array of String objects. | |
*/ | |
public class HelloWorld { | |
public static void main(String args[]) { | |
//The following line prints 'Hello World' to your console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
/** | |
* This example explains Java Strings and a few commonly used methods | |
* in the {@link String} class | |
* | |
*/ | |
public class JavaStrings { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
public class StringBufferAndBuilder { | |
public static final int MAX_ITER = 10000; | |
/** | |
* @param args | |
* This example shows how to perform common String operations in Java | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
/** | |
* This example explains how to create and use single and | |
* multidimensional arrays | |
*/ | |
public class JavaArrays { | |
public static void main(String args[]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.ListIterator; | |
/** | |
* This class explains the usage of Lists in Java | |
*/ | |
public class JavaLists { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.Set; | |
import java.util.TreeSet; | |
public class JavaSet { | |
public static void main(String args[]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.diycomputerscience; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.TreeMap; | |
public class JavaMaps { | |
public static void main(String args[]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "Hello World!" | |
print "Hello Again" | |
print "I like typing this." | |
print "This is fun." | |
print 'Yay! Printing.' | |
print "I'd much rather you 'not'." | |
print 'I "said" do not touch this.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A comment, this is so you can read your program later. | |
# Anything after the # is ignored by Python. | |
print "I could have code like this." # and the comment after is ignored | |
# You can also use a comment to "disable" or comment out a piece of code: | |
# print "This won't run." | |
print "This will run." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The meaning of operators in Python | |
# + plus Addition | |
# - minus Subtraction | |
# / slash Division | |
# * asterisk Multiplication | |
# / percent Also modulus operator, which returns the remainder from division | |
# < less-than Returns true if the operans on the LHS is less than RHS | |
# > greater-than Returns true if the operand on the LHS is greater than RHS | |
# <= less-than-equal Returns true if the operand on the LHS is less than or equal to RHS | |
# >= greater-than-equal Returns true if the operand on the LHS is greater than or equal to the RHS |
OlderNewer