Search

androidtour

Category

java

Some good sites to Learn design Pattern easily

javatpoint.com

tutorialpoint.com

http://www.newthinktank.com/videos/design-patterns-tutorial/

http://www.oodesign.com/

https://sourcemaking.com/design-patterns-book

Advertisements

Usefull notes about JAVA language concept

  1. One java file , contain only one public outer class which is same name as file name . In one package may be multiple public class but in different – different file not in single file.
  2. private access specifier are accessible only in one class ( outer | Inner ) in which they defined not outside of these class.
  3. protected –> access any class in same package  OR  can access any child from another package which uses super class. ( Super class must be in package in which protected is defined)
  4. default –> Only access from class of same package.
  5. public –> Accessible from any class any package.

javaFX Material Design Tutorial

https://www.youtube.com/channel/UCN1uaBxYSaVqDZMeSwOj_Xw/videos

 

JAVA FX tutorial and Example

https://github.com/PlusHaze/TrayNotification

http://javafx-demos.googlecode.com/svn-history/r100/trunk/javafx-demos/src/main/java/com/ezest/javafx/demogallery/swingawtintegration/JavaFXOnTrayIconDemo.java

https://gist.github.com/jewelsea/e231e89e8d36ef4e5d8a

https://gist.github.com/jewelsea

Convert jar file to Executable file for JAVA swing project

Method:1

Download “Lunch4j.exe” from internet and install it

https://www.youtube.com/watch?v=XITTQGD8V1s

Method:2

Download Advanced Installer from site

https://www.youtube.com/watch?v=0kBsPfdUhdg

Site for encode and decode the link/file [link]

http://coderstoolbox.net/string/#!encoding=url&action=encode&charset=us_ascii

Swing in java [Project]

http://freecode.com/tags/swing

https://java.net/projects_tags/swing

http://www.sourcecodesworld.com/source/BrowseCategory.asp?CatId=55

http://www.sourcecodesworld.com/source/show.asp?ScriptID=1181

https://kenai.com/projects_tags/swing

How to learn API?? API Testing ??? Webservices Testing ???

http://www.guru99.com/webservice-testing-beginner-guide.html

http://www.guru99.com/api-testing.html

https://zapier.com/learn/apis/chapter-4-authentication-part-1/

Some nice Tutorial of JAVA Real time Practical

http://www.javatips.net/blog/2012/06/using-twitter-api-with-java?page=2

http://www.javatips.net/blog/2011/08/findbugs-in-eclipse-java-tutorial?page=2

 

Nice Tutorial link for JAVA like this

http://www.javatips.net/blog/2014/10/create-bubble-chart-using-jfreechart

How to decide class is declare as subclass??? also decide method???

Is A??

Ask this is a this ? or not

Example:

Is a Dog an Animal???

Is a Dog a Cat??

Has A??

Ask this has a this ? or not

Example:

Dog has a Height??

Classification of Algorithm

There are broadly 4 ways in which classification of algorithms can be done.

  1. Classification by purpose

Each algorithm has a goal, for example, the purpose of the Quick Sort algorithm is to sort data in ascending or descending order. But the number of goals is infinite, and we have to group them by kind of purposes.

2.  Classification by implementation

  • Recursive or iterative
    A recursive algorithm is one that calls itself repeatedly until a certain condition matches. It is a method common to functional programming.
    For example, the towers of hanoi problem is well understood in recursive implementation. Every recursive version has an iterative equivalent iterative, and vice versa.
  • Logical or procedural
    An algorithm may be viewed as controlled logical deduction.
    A logic component expresses the axioms which may be used in the computation and a control component determines the way in which deduction is applied to the axioms.
  • Serial or parallel                                                                                Algorithms are usually discussed with the assumption that computers execute one instruction of an algorithm at a time. This is a serial algorithm, as opposed to parallel algorithms, which take advantage of computer architectures to process several instructions at once. Sorting algorithms can be parallelized efficiently.
  • Deterministic or non-deterministic
    Deterministic algorithms solve the problem with a predefined process whereas non-deterministic algorithm must perform guesses of best solution at each step through the use of heuristics.

3.   Classification by design paradigm

  • Divide and conquer
    A divide and conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually recursively), until the instances are small enough to solve easily. One such example of divide and conquer is merge sorting. The binary search algorithm is an example of a variant of divide and conquer called decrease and conquer algorithm, that solves an identical subproblem and uses the solution of this subproblem to solve the bigger problem.
  • Dynamic programming
    The shortest path in a weighted graph can be found by using the shortest path to the goal from all adjacent vertices.
    When the optimal solution to a problem can be constructed from optimal solutions to subproblems, using dynamic programming avoids recomputing solutions that have already been computed.
    – The main difference with the “divide and conquer” approach is, subproblems are independent in divide and conquer, where as the overlap of subproblems occur in dynamic programming.
    – Dynamic programming and memoization go together. The difference with straightforward recursion is in caching or memoization of recursive calls. Where subproblems are independent, this is useless. By using memoization or maintaining a table of subproblems already solved, dynamic programming reduces the exponential nature of many problems to polynomial complexity.
  • The greedy method
    A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage. Instead a “greedy” choice can be made of what looks the best solution for the moment.
    The most popular greedy algorithm is finding the minimal spanning tree as given by Kruskal.
  • Linear programming
    The problem is expressed as a set of linear inequalities and then an attempt is made to maximize or minimize the inputs. This can solve many problems such as the maximum flow for directed graphs, notably by using the simplex algorithm.
    A complex variant of linear programming is called integer programming, where the solution space is restricted to all integers.
  • Reduction also called transform and conquer
    Solve a problem by transforming it into another problem. A simple example:finding the median in an unsorted list is first translating this problem into sorting problem and finding the middle element in sorted list. The main goal of reduction is finding the simplest transformation possible.
  • Using graphs
    Many problems, such as playing chess, can be modeled as problems on graphs. A graph exploration algorithms are used.
    This category also includes the search algorithms and backtracking.
  • The probabilistic and heuristic paradigm
  1. Probabilistic
    Those that make some choices randomly.
  2. Genetic
    Attempt to find solutions to problems by mimicking biological evolutionary processes, with a cycle of random mutations yielding successive generations of “solutions”. Thus, they emulate reproduction and “survival of the fittest”.
  3. Heuristic
    Whose general purpose is not to find an optimal solution, but an approximate solution where the time or resources to find a perfect solution are not practical.

__________________________________________________________________

You can look at Algorithms Repository

1. Searching and sorting algorithms
Sorting algorithms include Quicksort , Merge sort, Heapsort, Bubble sort,Insertion sort, Radix sort. Other imp soting algorithms are Topological sort, Counting sort, Shell sort
A comprehensive list can be found here.
Important searching algorithms include breadth/ depth first  search, binary search etc.

2. Dynamic Programming — To name a few DP problems, Longest Common Subsequence problem, Knapsack, travelling salesman problem etc. A list of dynamic  programming algorithms can be found here.

3. Graph algorithms — Important graph algorithms are Dijkstra,

daqwest.com

Prim, Kruskal, Bellman-Ford. A comprehensive list can be found here.

Object oriented design tutorial link (Lynda)

https://www.youtube.com/watch?v=eRNCvxPNnck&list=PLqlI1RpjIS59ziAx7YBqQ0rtyAcpgdsjm

How to Generate Class Diagram and Convert it into JAVA Source Code

https://dashboard.genmymodel.com

For Direct Generate JAVA Source code from Diagram

ice_screenshot_20151108-133647

How to compapre two date in JAVA

– Return value is 0 if both dates are equal.
– Return value is greater than 0 , if Date is after the date argument.
– Return value is less than 0, if Date is before the date argument.

Date date1 = new Date();
Date date2 = new Date();

if(date1.before(date2)){
    //Do Something
}

if(date1.after(date2)){
    //Do Something else
}
Example:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        	Date date1 = sdf.parse("2009-12-31");
        	Date date2 = sdf.parse("2010-01-31");

        	System.out.println(sdf.format(date1));
        	System.out.println(sdf.format(date2));
        	
        	if(date1.compareTo(date2)>0){
        		System.out.println("Date1 is after Date2");
        	}else if(date1.compareTo(date2)<0){
        		System.out.println("Date1 is before Date2");
        	}else if(date1.compareTo(date2)==0){
        		System.out.println("Date1 is equal to Date2");
        	}else{
        		System.out.println("How to get here?");
        	}
Example :2

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        	Date date1 = sdf.parse("2009-12-31");
        	Date date2 = sdf.parse("2010-01-31");

        	System.out.println(sdf.format(date1));
        	System.out.println(sdf.format(date2));
        	
        	Calendar cal1 = Calendar.getInstance();
        	Calendar cal2 = Calendar.getInstance();
        	cal1.setTime(date1);
        	cal2.setTime(date2);
        	
        	if(cal1.after(cal2)){
        		System.out.println("Date1 is after Date2");
        	}
        	
        	if(cal1.before(cal2)){
        		System.out.println("Date1 is before Date2");
        	}
        	
        	if(cal1.equals(cal2)){
        		System.out.println("Date1 is equal Date2");
        	}

http://docs.oracle.com/javase/6/docs/api/java/util/Date.html#compareTo%28java.util.Date%29

			

JAVA Certified Cource Content

https://docs.oracle.com/javase/tutorial/extra/certification/javase-7-programmer1.html

Difference

  1. Apache tomcat server — Apache HTTP Server
  2. Server –Web server– Application Server –Database Server
  3. HTTP–HTTPS
  4. DBMS–RDBMS
  5. SQL–PL/SQL–NOSQL
  6. JSP–SERVLET
  7. Procedural Language–Object-oriented language
  8. JSON–GSON
  9. JQUERY–AQUERY–QUERY
  10. thread–asyntask

Best way to design good api

https://www.youtube.com/watch?v=aAb7hSCtvGw

Download Lecture PDF

Can we create static class at top level in JAVA???

Answer is :No

Outer classes cannot be static, but nested/inner classes can be. That basically helps you to use the nested/inner class without creating an instance of the outer class. Java has static methods that are associated with classes (e.g. java.lang.Math has only static methods), but the class itself is not static.

If you want to add static class functionality to top level class then follow below steps:

Java has static nested classes but it sounds like you’re looking for a top-level static class. Java has no way of making a top-level class static but you can simulate a static class like this:

  • Declare your class final – Prevents extension of the class since extending a static class makes no sense
  • Make the constructor private – Prevents instantiation by client code as it makes no sense to instantiate a static class
  • Make all the members and functions of the class static – Since the class cannot be instantiated no instance methods can be called or instance fields accessed
  • Note that the compiler will not prevent you from declaring an instance (non-static) member. The issue will only show up if you attempt to call the instance member.
public class TestMyStaticClass {
     public static void main(String []args){
        MyStaticClass.setMyStaticMember(5);
        System.out.println("Static value: " + MyStaticClass.getMyStaticMember());
        System.out.println("Value squared: " + MyStaticClass.squareMyStaticMember());
        // MyStaticClass x = new MyStaticClass(); // results in compile time error
     }
}

// A top-level Java class mimicking static class behavior
public final class MyStaticClass {
    private MyStaticClass () { // private constructor
        myStaticMember = 1;
    }
    private static int myStaticMember;
    public static void setMyStaticMember(int val) {
        myStaticMember = val;
    }
    public static int getMyStaticMember() {
        return myStaticMember;
    }
    public static int squareMyStaticMember() {
        return myStaticMember * myStaticMember;
    }
}

What good are static classes? 
A good use of a static class is in defining one-off, utility and/or library classes where instantiation would not make sense. A great example is the Math class that contains some mathematical constants such as PI and E and simply provides mathematical calculations. 

Dependency Injection in Object Oriented Programming

https://www.objc.io/issues/11-android/dependency-injection-in-java/

http://www.journaldev.com/2394/dependency-injection-design-pattern-in-java-example-tutorial

http://www.vogella.com/tutorials/DependencyInjection/article.html

http://www.javacreed.com/why-should-we-use-dependency-injection/

How to convert Arraylist to String array

dat is the arraylist object

String [ ] data = dat.toArray( new String[dat.size()]);

Step after Install JDK [java]

For setup JAVA Environment in your System

Install JDK from oracle

goto your installed java directory

copy the path : C:/programfile/java/jdk(versionname)/bin

Open environment variable setup menu from Computer Properties

In second Box click New and write name as JAVA_HOME and Copy this path without /bin

In PATH:  append this link with /bin

 

 

Program in JAVA for remove null production from CFG

NULL.txt

S@ABAC
A@aA/#
B@bB/#
C@c

 

 

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cd;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

/**
*
* @author soham
*/
public class null_removal {

static class OutputPrint {

void print() {
System.out.println();
}

void print(String msg) {
System.out.print(msg);
}

void print(Character c) {
System.out.println(c);
}

void print(StringBuilder c) {
System.out.println(c);
}

}

public static void main(String[] args) throws FileNotFoundException, IOException {
OutputPrint op = new OutputPrint();

byte[] datainBytes;
try (DataInputStream dis = new DataInputStream(new FileInputStream(“file/null.txt”))) {
datainBytes = new byte[dis.available()];
dis.readFully(datainBytes);
}
String content = new String(datainBytes, 0, datainBytes.length);
String input = content;
//Split data as per new line
String lines[] = input.split(“\\r?\\n”);
StringBuilder[] sb = new StringBuilder[lines.length];
//Store data in StringBuilder
for (int i = 0; i < lines.length; i++) {
sb[i] = new StringBuilder(“”);

char cm[] = lines[i].toCharArray();
for (int z = 0; z < cm.length; z++) {
if (cm[z] == ‘#’) {
sb[i].deleteCharAt(z – 1);
} else {
sb[i].append(cm[z]);
}
}
//op.print(sb[i]+”\n”);
}
//Store nonterminal which contain null in production
MyStack theStack = new MyStack(10);
for (String lin : lines) {
//op.print(lin);
if (lin.contains(“/”)) {

String[] bits = lin.split(“@”);
// TODO: Validate that there are exactly two parts
String first = bits[0];
String second = bits[1];
String production[] = second.split(“/”);
for (String pro : production) {
add_null(pro, theStack, first);
}
} else {
String[] bits = lin.split(“@”);
// TODO: Validate that there are exactly two parts
String first = bits[0];
String second = bits[1];
add_null(second, theStack, first);
}
}
//loop until stack not empty
while (!theStack.isEmpty()) {
Character value = theStack.pop();
//op.print(“Pop Character ” + value);
int k = 0;
for (StringBuilder pro : sb) {
printOutput(pro, op, value, sb, k);
k++;
}
op.print();
}
for (StringBuilder d : sb) {
op.print(d.toString() + “\n”);
}
}
//Ending Main Code , Method Implementation Start now

//for push non terminal which contain null
public static void add_null(String pro, MyStack theStack, String first) {
//op.print(first, pro);
if (pro.equals(“#”)) {
//op.print(“Found Null”);
theStack.push(first.charAt(0));
}
}

//Method for process and replace the RHS of production
public static void printOutput(StringBuilder pro, OutputPrint op, Character value, StringBuilder[] sb, int k) {
int q = k;
String[] bits = pro.toString().split(“@”);
// TODO: Validate that there are exactly two parts
String first = bits[0];
String second = bits[1];
StringBuilder h = new StringBuilder();
//op.print(“Second “+second+”\n”);
if (second.contains(“/”)) {
String production[] = second.split(“/”);
int r = 0;
ArrayList<Integer> number = new ArrayList<>();
for (String sec : production) {
char ch[] = sec.toCharArray();
//for two or more character value
for (int l = 0; l < ch.length; l++) {
if (ch[l] == value) {
r++;
number.add(l);
}
}
//      op.print(“Total Number of ch “+r+”\n”);
if (r > 1) {
for (int l = 0; l < r; l++) {
for (int j = 0; j < sec.length(); j++) {

if (j == number.get(l)) {

} else {
h.append(ch[j]);
//            op.print(“Append Ch “+ch[j]+”\n”);
}
}

appendString(sb, q, h, op);
if (l == r – 1) {
for (int j = 0; j < sec.length(); j++) {
if (ch[j] == value) {
} else {
h.append(ch[j]);
// op.print(“Append Ch “+ch[j]+”\n”);
}
}
appendString(sb, q, h, op);
}
}
} else {
if (sec.contains(String.valueOf(value))) {
for (int j = 0; j < sec.length(); j++) {
if (ch[j] == ‘#’ || ch[j] == ‘/’ || ch[j] == value) {
} else {
h.append(ch[j]);
//op.print(“Append Ch “+ch[j]+”\n”);
}
}
appendString(sb, q, h, op);
}
}
r = 0;
number.removeAll(number);
}
q++;
} else {
if (second.contains(String.valueOf(value))) {
for (int j = 0; j < second.length(); j++) {
char ch[] = second.toCharArray();
if (ch[j] == ‘#’ || ch[j] == ‘/’ || ch[j] == value) {
} else {
h.append(ch[j]);
//       op.print(“Append Ch “+ch[j]+”\n”);
}
}
appendString(sb, q, h, op);
} else {
//   op.print(sb[q]);
}
}
}

//function for append the String
public static void appendString(StringBuilder[] sb, int q, StringBuilder h, OutputPrint op) {
// sb[k].append(“/”);
sb[q].append(“/” + h);
h.delete(0, h.length());
// op.print(sb[q]);
}

//Method for Stack
public static class MyStack {

private final int maxSize;
private final Character[] stackArray;
private int top;

public MyStack(int s) {
maxSize = s;
stackArray = new Character[maxSize];
top = -1;
}

public void push(Character j) {
stackArray[++top] = j;
}

public Character pop() {
return stackArray[top–];
}

public Character peek() {
return stackArray[top];
}

public boolean isEmpty() {
return (top == -1);
}

public boolean isFull() {
return (top == maxSize – 1);
}

}
}

Design Pattern in JAVA

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code.

http://www.journaldev.com/1827/java-design-patterns-example-tutorial

http://www.newthinktank.com/videos/design-patterns-tutorial/

http://www.newthinktank.com/category/web-design/android-development-tutorial/page/8/

Installation of Hadoop in VMplayer in windows 8.1

Refer this for more info
http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/SingleCluster.html

Install ubuntu in vmware player

install JDK/JRE using command line
https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
For JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
For JRE
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Bydefault
JDK is installed in /usr/lib/jvm
for check wheather JDK is installed or not write java -version
http://www.howtogeek.com/191427/how-to-find-out-if-java-is-installed-in-ubuntu-and-how-to-install-it/

Download hadoop from this link
http://www.eu.apache.org/dist/hadoop/common/

Create hadoop folder in home directory and extract hadoop.tar in this folder

write sudo gedit /etc/profile
add this line in last of this file

JAVA_HOME=/usr/local/java/jdk1.8.0-60
PATH=$PATH:$JAVA_HOME/bin
JRE_HOME=/usr/local/java/jre1.8.0-60
PATH=$PATH:$JRE_HOME/bin
HADOOP_INSTALL=/home/hadoop/hadoop-1.2.1
PATH=$PATH:$HADOOP_INSTALL/bin
export JAVA_HOME
export JRE_HOME
export PATH

sudo update-alternatives –install “/usr/local/java” “java” “/usr/local/java/default-java/bin/java” 1

bin/hadoop jar hadoop-examples-*.jar grep input output ‘dfs[a-z.]+’

For remove JDK
http://ajgupta.github.io/ubuntu/2014/09/18/Completely-uninstall-Java-from-Ubuntu-14.04/
sudo apt-get install ssh

open conf/core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>

open hadoop-env.sh
change JAVA_HOME /usr/local/java/jdk1.8.0_60
make sure # must be removed

install ssh and rsync

setup password key and run two command from first link of thisa artical

goto hadoop folder and write
bin/hadoop namenode format

for start all node and process regarding hadoop
bin/start-all.sh

jps is used for show the running process
jps is a command

bin/hadoop fs -put conf input

for install cludera installtion
http://pyfunc.blogspot.in/2012/05/hadoop-pseudo-cluster-installation.html

for kill the process on port
sudo kill `sudo lsof -t -i:9000`

netstat -nlp
for show the process

Find first( ) from CFG using JAVA

Under Testing….

How to remove Unit production from CFG using JAVA

package cd;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
/**
*
* @author Soham Navadiya
*/
public class Unit_Production {
static int caseCheck(String c){
if(c.matches(“[A-Z]”)){
return 1;
}
else if(c.matches(“[a-z]”)){
return 2;
}
else{
return 0;
}
}
public static void main(String []args) throws FileNotFoundException, IOException{

int check;
ArrayList<String> terminal=new ArrayList<String>();
ArrayList<String> nonterminal=new ArrayList<String>();

DataInputStream dis = new DataInputStream (new FileInputStream (“file/production.txt”));
byte[] datainBytes = new byte[dis.available()];
dis.readFully(datainBytes);
dis.close();
String content = new String(datainBytes, 0, datainBytes.length);
String input = content;

String lines[] = input.split(“\\r?\\n”);

Character [][]production=new Character[10][10];
int k=0;
ArrayList<Integer> len=new ArrayList<Integer>();
for(String i:lines){
len.add(i.length());
//System.out.println(“Production:”+i+”—Length: “+i.length());
for(int j=0;j<i.length();j++){
char[] chara=i.toCharArray();
production[k][j]=chara[j];
//System.out.print(production[k][j]);
}
//  System.out.println();
k++;

/*check=caseCheck(i);
if(check==1){
nonterminal.add(i);
System.out.println(“Non terminal: “+i);
}
else if(check==2){
terminal.add(i);
System.out.println(“Terminal: “+i);
}*/
}

for(int i=0;i<len.size();i++){
//System.out.print(“Length is: “+l+”\n”);
for(int j=0;j<len.get(i);j++){
// System.out.print(production[i][j]+”|”);
if(j==0){
check=caseCheck(production[i][j].toString());
if(check==1){
nonterminal.add(production[i][j].toString());
//System.out.println(“Non terminal is:” +production[i][j]);
}
}
}
}
String firstSubString = null;
String secondSubString;
for(int i=0;i<len.size();i++){

String ln2=lines[i].substring(0, lines[i].indexOf(“@”));
String ln=lines[i].substring(lines[i].lastIndexOf(“@”) + 1);

//System.out.println(“Left Part part is “+ln2);
//System.out.println(“Right part is”+ln);

if(ln.length()==1){
int h=check(ln,nonterminal);

if(h==0){
System.out.println(ln2+” @ “+ln);
}

if(h==1){

System.out.print(“Replace with “+ln2+” @ “);
//System.out.println(“Unit Production is “+ln);
//System.out.println(“Left Part part is “+ln2);

for(int p=0;p<len.size();p++){

String[] split = lines[p].split(“@”);

firstSubString = split[0];
secondSubString = split[1];

//char c=production[p][0];

if(firstSubString.equals(ln)){

System.out.println(secondSubString);
//System.out.println(“You have to Replace with “+secondSubString);

}
}
//System.out.println(“Left part is “+firstSubString);
//System.out.println(“Right part is “+secondSubString);
}

}
else{

System.out.println(ln2+” @ “+ln);
}

//  System.out.println();
}
// System.out.println(“After @ Length of String “+ln.length());
// System.out.println();
// System.out.println(“———–“);
/*
String example = “A@bCd”;
System.out.println(example.substring(example.lastIndexOf(“@”) + 1));
*/
}
static int check(String c,ArrayList<String> arr){
if(testAllUpperCase(c)){

if(arr.contains(c)){

return 1;
}
else
{
return 2;
}

}
else{
return 0;
}
}

public static boolean testAllUpperCase(String str){
for(int i=0; i<str.length(); i++){
char c = str.charAt(i);
if(c >= 97 && c <= 122) {
return false;
}
}
//str.charAt(index)
return true;
}
}

Protected: How to generate UML ( Class , Sequence ) Diagram from JAVA file or Project

This content is password protected. To view it please enter your password below:

Protected: Super not regarding JDBC

This content is password protected. To view it please enter your password below:

Protected: Object oriented design interms of Programming ( Very usefull for develop the Efficient Software)

This content is password protected. To view it please enter your password below:

Use full Information regarding Regular Expression

In most regex dialects there are a set of convenient character summaries you can use for this kind of thing – these are good ones to remember:

\w – Matches any word character.

\W – Matches any nonword character.

\s – Matches any white-space character.

\S – Matches anything but white-space characters.

\d – Matches any digit.

\D – Matches anything except digits.

A search for “Regex Cheatsheets” should reward you with a whole lot of useful summaries.

What is Data buffer?

In computer science, a data buffer (or just buffer) is a region of a physical memory storage used to temporarily store data while it is being moved from one place to another.

Buffers are often used in conjunction with I/O to hardware, such as disk drives, sending or receiving data to or from a network, or playing sound on a speaker.

What is Serialization?

Serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.

final keyword regarding variable and method

“Final” variable is a constant, once one variable declare with final than during whole program can not change this variable value.

EX. final public static int a = 5;

After declare this statement you can not change the value of variable a.

Final Method

You can not overridden in any subclass. you can not use this final declare value to subclass.

Classes in JAVA for Data structure

Classes

ArrayList

LinkedList

HashSet

LinkedHashSet

TreeSet

PriorityQueue

ArrayDeque

EnumSet

For Retrieve data from this classes

Using Intrator

Using for loop

Interfaces in JAVA for Data Structure

Collection

List

Set

SortedSet

NavigableSet

Queue

Dequeue

 

Difference between JDK JRE JVM

JVM(Java Virtual Machine)

JRE(Java Runtime Environment)

JDK(Java Development Kit )

Create a free website or blog at WordPress.com.

Up ↑