Preview

Java Coding Sample

Satisfactory Essays
Open Document
Open Document
627 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java Coding Sample
Java Coding Samples
Various Java programs to illustrate various concepts
A Hello World! Java program.
Calling Methods. A sample of how to call methods in the same class.
For loop. A simple example of using for loops to calculate factorial. Uses the built in int data type so only good to 13!
Enhanced for loop
Value Parameters: An example that shows the behavior of value parameters. In Java all parameters are passed by value.
String Example. A few brief examples of String manipulations.
BinaryConverter. A program with examples of various Java syntax that converts a base 10 int to base 2 String.
PrimeEx A program with various approaches to determine if an int is prime or not. Used to demonstrate Java syntax. You need the Stopwatch class, a non standard Java class, as well.
Pointers as Value parameters
Array Examples
2D array Example. A simplified version of filtering a picture represented by ints.
2D array example. Very simple version of the Conway's Game of Life.
Getting input from Keyboard with Scanner class
Reading ints from file with Scanner class
Writing ints to file
Connecting to and reading from a web page.
Program to create ASCII frequency table from file and url. Demonstration of try / catch blocks. The CIA 2008 Factbook may be downloaded from Project Gutenberg.
IntListVer1 First version of the IntList class developed in class. Developing class to illustrate various class design and implementation issues in Java.
IntListTesterVer1
IntListVer2 Added default add method, equals method, and toString methods. Includes versions of toString using String concatenation and StringBuffer to illustarte performance differences.
IntListTesterVer2
IntListVer3. Added insert and remove methods.
SortedIntList. Inherits from InListVer3 to create a SortedIntList. Class is "broken" because random insertions still allowed.
GenericList. Altered the list to store anything, not just ints.
Die class. A class that models a playing die.
DemoClass: This

You May Also Find These Documents Helpful

  • Good Essays

    Nt1420 Unit 6

    • 1145 Words
    • 5 Pages

    INSTRUCTIONS: 1. THERE ARE SIX (6) QUESTIONS IN THIS PAPER. 2. ANSWER FIVE (5) QUESTIONS ONLY. Question 1 Arrays are used when storing a large number of values. You are required to create an array named a and answer the following questions regarding array manipulation. a. Write a method fillRandom(int[] a, int min, int max), fill the array a with a random integer value. (Note: Math.random() returns a double in the range of 0.0 and 1.0, therefore it is cast to an integer number, between the minimum and maximum value). [6 marks] b. Write the Bubble sort method to sort array a into descending order. [10 marks] c. In the quicksort, an algorithm an element is chosen from the unsorted list. This element is called the…

    • 1145 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Exercise 1: Review of array-based lists Create a project using the classes in the DocSharing area labeled “User-defined array list." Compile it, run it, and review the code that is given carefully. This code tests the ArrayList class provided in the lecture.…

    • 714 Words
    • 3 Pages
    Good Essays
  • Good Essays

    ECET 370 Week 5 Lab 5

    • 650 Words
    • 3 Pages

    Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week's lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully.…

    • 650 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Homework Unit 3

    • 354 Words
    • 2 Pages

    6. In passing argument by value- any changes made to the parameter value won't affect argument outside module. In passing argument by reference- Changes will affect actual argument passed to module.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    ● Converts the value of i to double and stores it in d. This conversion is done automatically by the compiler, because double data type is normally wider than int, there is absolutely no risk storing int in double.…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Attribute-Based Programming: Attributes assist you to add declarative information in your programs. This information can then be queried at runtime using reflection.…

    • 485 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    PRG 421 – JAVA PROGRAMMING II – Complete Class Includes All DQs, Individual and Team Assignments – UOP Latest…

    • 693 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    3) Exceptions in java are divided into two categories – checked and unchecked.Where as all Errors belongs to only one category i.e. unchecked.…

    • 559 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Nt1310 Unit 1 Assignment

    • 1994 Words
    • 8 Pages

    * The binary numbering system plays a central role in how information of all kinds is stored on the computer. Understanding binary can lift a lot of the mysteries from computers because at a fundamental level they're really just machines for flipping binary digits on and off. There are several activities on binary numbers in this document, all simple enough that they can be used to teach the binary system to anyone who can count! Generally children learn the binary system very quickly using this approach, but we find that many adults are also excited when they finally understand what bits…

    • 1994 Words
    • 8 Pages
    Better Essays
  • Good Essays

    This paper will describe the variable naming rules of three different programming languages. These three languages are Visual Basic, Python, and Java. Each of these languages has different rules that apply to them and some similarities. I will describe the rules and the similarities and differences in the next few paragraphs.…

    • 878 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Pt1420 Unit 1 Assignment 2

    • 1305 Words
    • 6 Pages

    Hosch, L., Liesandthem, G., Luebring, J.E., Pallardy, R., Young, G. (2014). Java. In Encyclopedia Britannica.…

    • 1305 Words
    • 6 Pages
    Powerful Essays
  • Powerful Essays

    Searching and Sorting Streams and Files Graphics GUI Components and Events Mouse, Keyboard, Sounds, and Images Big-O Analysis of Algorithms The Java Collections Framework Lists and Iterators Stacks and Queues Recursion Revisited Binary Trees Lookup Tables and Hashing Heaps and Priority Queues Design Patterns…

    • 3908 Words
    • 16 Pages
    Powerful Essays
  • Better Essays

    1) You can call the module several times instead of writing it out each time.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Good Essays

    Java

    • 490 Words
    • 3 Pages

    Write a Java program to demonstrate using bitmaps and bitwise operators to sort and remove duplicates from a file of random phone numbers. Do not confuse the term bitmap used for compressing data into smaller spaces with the bitmap that has come to mean a graphic image.…

    • 490 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Onetop Master

    • 439 Words
    • 2 Pages

    A public static method named computeSum() is located in classA. To call the method from within classB, use the statement ___________.…

    • 439 Words
    • 2 Pages
    Good Essays

Related Topics