Find the best tutors and institutes for Java Training

Find Best Java Training Classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

Java Training Updates

Ask a Question

Post a Lesson

All

All

Lessons

Discussion

Answered on 02 Jul IT Courses/Java

Anuraag

There are plenty of opportunities, but it requires hard work to move from mechanical to software development. First be clear about which technology you want to learn, start from the basics, practice as hard as you can, which generally lacks in most of the students. Once you cover the basics, learn frameworks... read more

There are plenty of opportunities, but it requires hard work to move from mechanical to software development. First be clear about which technology you want to learn, start from the basics, practice as hard as you can, which generally lacks in most of the students. Once you cover the basics, learn frameworks and web services supporting that particular technology which most of the companies are expecting in the current scenario. To do all this, you need to be patient and work as per your plans without getting demotivated.

read less
Answers 41 Comments
Dislike Bookmark

Lesson Posted on 08 Jul IT Courses/Java/Core Java

Puzzle Game coding

Venkatesh Kammampati

I am an experienced in teaching JAVA and Quantitative Aptitude with JOB Assistance. Strong in Analytical...

import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.Font;import java.awt.FontMetrics;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.RenderingHints;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.util.Random; import... read more

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Random;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import java.util.Random;
public class GameOfFifteen extends JPanel
{
private int size;
private int nbTiles;
private int dimension;
private static final Color FOREGROUND_COLOR=new Color(239,83,80);
private static final Random RANDOM=new Random();
private int[] tiles;
private int tileSize;
private int blankPos;
private int margin;
private int gridSize;
private boolean gameOver;
public GameOfFifteen(int size, int dimension, int margin)
{
super();
this.size = size;
this.dimension = dimension;
this.margin = margin;
nbTiles=size*size-1;
tiles=new int[size*size];
gridSize=(dimension-2*margin);
tileSize=gridSize/size;
setPreferredSize(new Dimension(dimension,dimension+margin));
setBackground(Color.WHITE);
setForeground(FOREGROUND_COLOR);
setFont(new Font("SansSerif",Font.BOLD,60));
gameOver=true;
addMouseListener(new MouseAdapter(){

public void mousePressed(MouseEvent e)
{

if(gameOver)
{
newGame();
}
else
{
int dir=0;
int ex=e.getX()-margin;
int ey=e.getY()-margin;
if(ex<0||ex>gridSize||ey<0||ey>gridSize)
return;
int c1=ex/tileSize;
int r1=ey/tileSize;
int c2=blankPos%size;
int r2=blankPos/size;
int clickPos=r1*size+c1;
if(c1==c2 && Math.abs(r1-r2)>0)

dir=(r1-r2)>0 ? size:-size;

else if(r1==r2 && Math.abs(c1-c2)>0)
dir=(c1-c2)>0? 1:-1;

if(dir!=0)
{
do {
int newBlankPos=blankPos+dir;
tiles[blankPos]=tiles[newBlankPos];
blankPos=newBlankPos;
}while(blankPos!=clickPos);
tiles[blankPos]=0;
}
gameOver=isSolved();
}
repaint();
}
});
newGame();

}
private void newGame() {
do {
reset();
shuffle();
}while(!isSolvable());
gameOver=false;
}
private void reset() {
for(int i=0;i<tiles.length;i++) {
tiles[i]=(i+1)%tiles.length;
}
blankPos=tiles.length-1;
}
private void shuffle()
{
int n=nbTiles;
while(n>1)
{
int r=RANDOM.nextInt(n--);
int tmp=tiles[r];
tiles[r]=tiles[n];
tiles[n]=tmp;
}
}
private boolean isSolvable()
{
int countInversions=0;
for(int i=0;i<nbTiles;i++)
{
for(int j=0;j<i;j++)
{
if(tiles[j]>tiles[i])
countInversions++;
}
}
return countInversions%2==0;
}
private boolean isSolved()
{
if(tiles[tiles.length-1]!=0)
return false;
for(int i=nbTiles-1;i>=0;i--)
{
if(tiles[i]!=i+1)
return false;
}
return true;
}
private void drawGrid(Graphics2D g)
{
for(int i=0;i<tiles.length;i++)
{
int r=i/size;
int c=i%size;
int x=margin+c*tileSize;
int y=margin+r*tileSize;
if(tiles[i]==0) {
if(gameOver) {
g.setColor(FOREGROUND_COLOR);
drawCenteredString(g,"|///",x,y);
}
continue;
}
g.setColor(getForeground());
g.fillRoundRect(x, y, tileSize, tileSize, 25, 25);
g.setColor(Color.BLACK);
g.drawRoundRect(x,y,tileSize,tileSize,25,25);
g.setColor(Color.WHITE);
drawCenteredString(g,String.valueOf(tiles[i]),x,y);
}
}
private void drawStartMessage(Graphics2D g) {
if(gameOver) {
g.setFont(getFont().deriveFont(Font.BOLD,18));
g.setColor(FOREGROUND_COLOR);
String s="Click to start new game";
g.drawString(s, (getWidth()-g.getFontMetrics().stringWidth(s))/2, getHeight()-margin);
}
}
private void drawCenteredString(Graphics2D g,String s,int x,int y)
{
FontMetrics fm=g.getFontMetrics();
int asc=fm.getAscent();
int desc=fm.getDescent();
g.drawString(s,x+(tileSize-fm.stringWidth(s))/2,y+(asc+(tileSize-(asc+desc))/2));
}
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2D=(Graphics2D)g;
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
drawGrid(g2D);
drawStartMessage(g2D);
}
public static void main(String[] args)
{
SwingUtilities.invokeLater(() ->
{
JFrame frame=new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Game of Fifteen");
frame.setResizable(false);
frame.add(new GameOfFifteen(4,550,30),BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
}

read less
Comments
Dislike Bookmark

Lesson Posted on 05 Jul IT Courses/Java/Core Java

COMPILATION AND INTERPRETATION

Khushi A.

1- Year Online Teaching Experience 1- Year It Industry Exposure Technical Skills Core Java - Basic...

Compilation and Interpertation Process javac (compiler) java(interpreter)high level code - > compile - > bytecode - > interperted - > machine code Bytecode is intermediate code generated by compiler, this is same will be for all the systems/computersthat... read more

Compilation and Interpertation Process

                          javac (compiler)             java(interpreter)
high level code - > compile - > bytecode - > interperted - > machine code


Bytecode is intermediate code generated by compiler, this is same will be for all the systems/computers
that is why our java is portable and independent programming language.

COMMAND TO EXECUTE PROGRAM ON COMMAND PROMPT

ASSUMING WE CREATED A JAVA PROGRAM WITH CLASS NAME Calculator.java

1. javac Calculator.java // compilation is beginning, compiler generates bytecode, at once the code is compiled.

BYTECODE FILE IS SAVED AS .CLASS, for above example the file that is created is Calculator.class

2. java Calculator // interpertating is beginning, result will be generated, each and every line is checked and interperted(one - by - one)

JDK vs JRE vs JVM
JDK(JAVA DEVELOPMENT KIT) --> It holds jre, tools for the development of java application like compiler, interpreter,etc. It has physical existence in our machine.
JRE(JAVA RUNTIME ENVIRONMENT) --> it holds JVM + Java libraries and is physically present in our system.
JVM(JAVA VIRTUAL MACTINE) --> it is a virutal machine that helps to load code, verify code, and execute code.

read less
Comments
Dislike Bookmark

Looking for Java Training Classes

Find best Java Training Classes in your locality on UrbanPro.

FIND NOW

Lesson Posted on 23 Jun IT Courses/Java

Constructor in Java

Amit Kumar

Join us to become SKILLED Software Engineer's. I am having 14+ years of Industry Experience in Project...

A constructor is a particular type of method that is used to initialise the object. The constructor is invoked at the time of object creation. It constructs the values, i.e. provides data for the object that is why it is known as a constructor. A constructor can’t be static. There are two types... read more

A constructor is a particular type of method that is used to initialise the object. The constructor is invoked at the time of object creation. It constructs the values, i.e. provides data for the object that is why it is known as a constructor.

A constructor can’t be static.

There are two types of constructors:

- Default constructor (no-arg constructor)

- Parameterised constructor

- Constructor Chaining (base class constructor called first)

- Use super to call parent class constructor/methods

- Use this to call invoking object constructor/methods

read less
Comments
Dislike Bookmark

Answered on 17 Jun IT Courses/Java/Core Java

Sumit Agarwal

Tutor

Java is pure object oriented programming language because it follows all the characteristics of OOPS paradigm.
Answers 8 Comments
Dislike Bookmark

Lesson Posted on 11 Jun IT Courses/Java

Access Specifiers ?? Private, Protected, Public, Package-private

Amit Kumar

Join us to become SKILLED Software Engineer's. I am having 14+ years of Industry Experience in Project...

Access level modifiers determine whether other classes can use a particular field or invoke a particular method. The following table shows the access to members permitted by each modifier. Access Levels Access Specifiers Class Within Package Outside package + Subclass World public Y Y Y Y protected Y Y Y N Package-private Y Y N N private Y N N N The... read more

Access level modifiers determine whether other classes can use a particular field or invoke a particular method.

The following table shows the access to members permitted by each modifier.

Access Levels

Access Specifiers

Class

Within Package

Outside package + Subclass

World

public

Y

Y

Y

Y

protected

Y

Y

Y

N

Package-private

Y

Y

N

N

private

Y

N

N

N

The first data column indicates whether the class itself has access to the member defined by the access level. As you can see, a class always has access to its own members. The second column indicates whether classes in the same package as the class (regardless of their parentage) have access to the member. The third column indicates whether subclasses of the class declared outside this package have access to the member. The fourth column indicates whether all classes have access to the member.

read less
Comments
Dislike Bookmark

Lesson Posted on 11 Jun IT Courses/Java

Final modifier in Java

Amit Kumar

Join us to become SKILLED Software Engineer's. I am having 14+ years of Industry Experience in Project...

Can’t change value of variable if marked as final. It is best practice to mark method parameter as final if its value will not changes. Variable must be initialize either using Initializer block / constructor OR assignment during declaration. It is threading safe. Method marked as final... read more
  • Can’t change value of variable if marked as final. It is best practice to mark method parameter as final if its value will not changes. Variable must be initialize either using Initializer block / constructor OR assignment during declaration. It is threading safe.

 

  • Method marked as final can’t be override. Generally, those we put final method while defining abstraction functionalty where we can’t changes a defined functionality.

 

  • Class marked as final can’t be inheriting by anyother class.

 

  • String class is final class that’s why we can’t override its methods.
read less
Comments
Dislike Bookmark

Lesson Posted on 11 Jun IT Courses/Java

Java Achieve (JAR)

Amit Kumar

Join us to become SKILLED Software Engineer's. I am having 14+ years of Industry Experience in Project...

Java Archieve is a binary form to bundle a Java library which equivalent to zip file. It contains .class files, .properties, .jpeg, OR any supporting files to execute this library. For Example- junit.jar, rt.jar, etc Create JAR file jar -cvf bundle.jar *.class Execute classes from JAR file ... read more

Java Archieve is a binary form to bundle a Java library which equivalent to zip file. It contains .class files, .properties, .jpeg, OR any supporting files to execute this library. For Example- junit.jar, rt.jar, etc

  • Create JAR file

jar -cvf bundle.jar *.class

  •  Execute classes from JAR file

          java -cp C:\temp\bundle.jar FirstCommanLineProgram

read less
Comments
Dislike Bookmark

Lesson Posted on 24 May IT Courses/Java/Core Java

CONDITIONAL STATEMENT - IF ELSE

Khushi A.

1- Year Online Teaching Experience 1- Year It Industry Exposure Technical Skills Core Java - Basic...

1. IF condition only if is true conditon is required. if(condition){//statements} 2. IF-ELSE condition 1. to check whether the condition will be true or false.syntax of if-else2. only 1 conditionif(condition){//statements}else{//statements} 3. if - else if we can add "else if" to execute multiple... read more

1. IF condition

only if is true conditon is required.

if(condition)
{
//statements
}


2. IF-ELSE condition

1. to check whether the condition will be true or false.
syntax of if-else
2. only 1 condition
if(condition)
{
//statements
}
else
{
//statements
}


3. if - else if

we can add "else if" to execute multiple conditions

syntax
if(condition)
{
//statements
}
else if(condition)
{
//statements
}
else if(condition)
{
//statement
}
else
{
//statement
}


4. Nested if-else condition
if(condition)
{
//statements
if(condition)
{
//statement
}
else
{
//statement
}
//statement
}
else
{
//statements
if(condition)
{
// statement
}
else if(condition)
{
//statement
}
else
{
//statement
}
}

read less
Comments
Dislike Bookmark

Looking for Java Training Classes

Find best Java Training Classes in your locality on UrbanPro.

FIND NOW

Answered on 07/12/2018 IT Courses/Java IT Courses/Java Script Training Tuition/BCA Tuition/Java Programming +1 IT Courses/Java/Core Java less

Sailaxmi R

Hi, OOP concepts are foundation for Java. You have plaenty of resources on internet to start with that. Attend any classroom session. and pratices yourself.
Answers 3 Comments 1
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best Java Training Classes in India. Post Your Requirement today and get connected.

Overview

Questions 767

Lessons 107

Total Shares  

+ Follow 88,212 Followers

Related Topics

Top Contributors

Connect with Expert Tutors & Institutes for Java

x

Ask a Question

Please enter your Question

Please select a Tag

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more