Abstract Class and keyword Java

http://xahlee.info/java-a-day/abstract_class.html

Advertisements
Posted in Uncategorized | Leave a comment

Great Link for Interviewers

http://www.developersbook.com/corejava/interview-questions/corejava-interview-questions-faqs.php

Posted in Uncategorized | Leave a comment

Print Factorial of Number using Lambda Expression Java

import org.testng.annotations.Test;

/**
* Print Factorial of a Number using Lambda Expression Java
* @author asharda
*
*/
public class Factorial {
interface Fact
{
int result(int n);
}
@Test
public void testFactorial()
{
Fact f= (n) -> {
int result =1;
if(n==1)
{
return 1;
}
for (int i=n;i>1;i–)
{
result =result*i;
}

return result;
};

System.out.println(f.result(5));
}
}

Posted in Java, Uncategorized | Leave a comment

How to check if number is an even number using Lambda Expression -Java

import org.testng.annotations.Test;

/**
* Check if number is an even number using Lambda expression Java
* @author asharda
*
*/
public class TestLambdaExpression {

interface MyNumber
{
boolean getVal(int n);

}

@Test
public void testLambda()
{
MyNumber myNum;
myNum= (n)-> (n %2 ==0);
System.out.println(myNum.getVal(11));
if(myNum.getVal(10))
{
System.out.println(“Number is an even number”);
}
else
{
System.out.println(“Number is an odd number”);
}
}
}

Posted in Java, Uncategorized | Leave a comment

Pie Chart with colors using R

x <-c(83,75)
labels <-c(“Sai”,”Ashish”)
png(file = “ashish.jpg”)
pie(x,labels,main=”Test Chart”,col=rainbow(length(x)))
dev.off()

Posted in R | Leave a comment

Pie Chart using R

# Create data for the graph.
x <- c(81, 62, 93, 83)
labels <- c(“Ashish”, “Sai”, “Jai”, “Kai”)

# Give the chart file a name.
png(file = “marks.jpg”)

# Plot the chart.
pie(x,labels)

# Save the file.
dev.off()

Posted in R | Leave a comment

Print Nested List in List using R

#Lists in R
list1 <-list(c(“A”,”B”,”C”),”B”)
print(list1)

Posted in R, Uncategorized | Leave a comment