GeeksforGeeks
geeksforgeeks.org › java › java-programming-examples
Java Programs - Java Programming Examples - GeeksforGeeks
September 2, 2026 - A collection of Java programming examples covering a wide range of topics, from basic programs and pattern printing to arrays, strings, collections, file handling, exception handling, and multithreading.
Programiz
programiz.com › java-programming › examples
Java Examples | Programiz
Java Program to Remove elements from the LinkedList.
What are your favorite examples of "good code"?
Nothing comes close to guava in quality. More on reddit.com
Java basics with examples
Why not just ask here what you're having trouble with? Let's have a crack, shall we? This is a class: public class Demo { } There is nothing in it (well, there is... it actually looks like this) public class Demo { public Demo(){ super(); } } Which is to say that in Java, when you write the Demo code I initially wrote, the compiler sneakily makes a method called Demo, with a method call of super(). It won't do this if you make your own constructor, but let's not focus on that - let's ask why the compiler would be so sneaky. A class is a blueprint in java, but it's not very useful on it's own - it needs to be "instantiated". In the same way that a factory might have a blueprint for a tank. Blueprints for tanks aren't very useful on their own - ask the Polish military during WW2 about how that panned out*. What is useful is a tank - but note you cannot make a tank without a blueprint. Ok, so if a class is the blueprint, what is, to continue the analogy, the outcome of the blueprint? Well, that's called an object. An object is to a class, as a tank is to a blueprint. Now in the factory, you make a tank by turning the machine on. In java, it's a little different - each class has it's own "on" switch. It would be better to think of the analogy as a spell in a spell book. The spell in written form isn't going to blow up a house. But incant the spell and kaboom! So a class is like a spell - abracadabra. And an object is the bolt of lightning that jumps forth. Which is all a long way of saying that the sneaky code Java adds is like when you read the spell. In fact, that code is a method, and a particular method - it's called a constructor. So now we have the constructor, (which is a method) and the end result is an object (which is a class made "real"). A useful class will define things - it's state. Like this: class Person { int age; } (Yes, java will also add a constructor, identical to the earlier one, but this one will be called "Person"). When you want to make this Person "real" you call that constructor. But how? You use the "new" method. So you would write Person peter = new Person(); Now you have made a Person. Saying "new Person()" is like reading the incantation. The... magic that makes that into an object is in the constructor that Java adds. If Person then has another method called, uh, "sayHello()" then you would call it like this: peter.sayHello(); //good boy Peter! Is this... useful? *I don't actually know if that story about the Polish with the cardboard tanks is real or not, one images it was grossly exaggerated. But it's a nice teaching image, right? More on reddit.com
Professional Java code examples?
Look at the source code of some of the apache projects like apache commons. It's source can be browsed online.
More on reddit.comWhere can I read well written Java code?
That is a lousy professor. You want to learn more? Nope, don't think so. You could find open source projects that are written in java. Or maybe check out the source code for OpenJDK (library implementation). But better yet, pick up a book. You have the popular book Clean Code by R. C. Martin that covers how to write clean and maintainable code. Or maybe the book Head first: Design Patterns by that covers common designs used to make adaptable and reusable code. But your professor has one point. You should not get lost into code design when still learning the basics. So remember to focus on what you learn in class! :) More on reddit.com
Tpoint Tech
tpointtech.com › java-programs
Java Programs | Java Programming Examples - Tpoint Tech
February 10, 2026 - These programs demonstrate pattern printing using loops and basic control statements. Java program to print the following spiral pattern on the console
University of Texas
cs.utexas.edu › ~scottm › cs307 › codingSamples.htm
Java Coding Samples
UnsortedSetTest - A method to compare Java's TreeSet and HashSet to the BianrySearchTree, UnsortedSet, and UnsortedHashSet classes developed in class. Note you need a lot of other files for this to work. SimpleWordCount - Program demonstrating use of a map to count the frequency of words in a file.
BeginnersBook
beginnersbook.com › 2017 › 09 › java-examples
Java Programs – Java Programming Examples with Output
Write java program to find if a name exists in a list of names.The program should display how many times the name occurs in the list.The program should have at least two instance methods. ... Hi where can i get real time example programs such as 1 find out the no of persons in a room 2 Find the electricity bill for one month
CodeScracker
codescracker.com › java › program › java-programming-examples.htm
Java Programming Examples
Java Programming Examples with Output: I've written around 500 Java codes here, separated into more than 100 Java program articles.
WsCube Tech
wscubetech.com › resources › java › programs
Java Programs (Code Examples With Output)
Practising small examples strengthens logic, improves problem-solving, and prepares you for coding rounds, interviews, and real-world Java development. Whether you want to learn basics or solve advanced logic-building problems, this page gives you a complete collection of Java programs with explanations and outputs.
TutorialsPoint
tutorialspoint.com › javaexamples › index.htm
Java Programming Examples
Here are most commonly used examples − · How to sort an array and search an element inside it? How to sort an array and insert an element inside it? How to determine the upper bound of a two dimentional array? ... Learn how to play with data and time in Java programming.
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
Ipsgwalior
ipsgwalior.org › download › javaprograms.pdf pdf
JAVA PROGRAMS Display odd numbers between 1 -100 class OddNumber {
Program for Linear search · import java.util.Scanner; class LinearSearch ·
Karanartscollege
karanartscollege.edu.in › assets › images › ebook › 100+ Java Programs with Output_ Useful collection of Java Programs ( PDFDrive ).pdf pdf
100+ Java Programs with Output
Scanner class to get input from user. This program firstly asks the user to enter a string · and then the string is printed, then an integer and entered integer is also printed and finally · a float and it is also printed on the screen. Scanner class is present in java.util package so
YouTube
youtube.com › watch
Simple java program examples for beginners | Hello world java code | Start Programming with Java - YouTube
Simple java program examples for beginners and Hello world java code and Start Programming with JavaComputer Education for all provides In this Tutorial abou...
Published: July 31, 2017