Scala - Error in Inheritance: <console>:: error: not found: value

0 votes

Hello , I am facing the below issue while executing the below code.

Can you please assist?

class vehicle (year:Int){

var Year = year

def cardet(name:String) {

var Name = name

println("Car name" + " " + name + " " + "Year" + " " + year)}}


class car(Speed:Int) extends vehicle(year){

var model = " " 

def printc() = { "Model " + " " + model + "Speed" + "  " + Speed + "Year" + "  " + Year}

}

<console>:8: error: not found: value year

       class car(Speed:Int) extends vehicle(year){
Aug 1, 2019 in Apache Spark by Ramya
1,515 views

1 answer to this question.

0 votes

You need to declare the variable which you have in the parent class in the derived class as well. Refer to the below screenshot,image

answered Aug 1, 2019 by Karan

Related Questions In Apache Spark

0 votes
1 answer

Scala: error: value unary_+ is not a member of (Int, Int)

All prefix operators' symbols are predefined: +, -, ...READ MORE

answered Jul 22, 2019 in Apache Spark by karan
511 views
0 votes
1 answer

where can i get spark-terasort.jar and not .scala file, to do spark terasort in windows.

Hi! I found 2 links on github where ...READ MORE

answered Feb 13, 2019 in Apache Spark by Omkar
• 69,030 points
407 views
+1 vote
1 answer

Error: value textfile is not a member of org.apache.spark.SparkContext

Hi, Regarding this error, you just need to change ...READ MORE

answered Jul 4, 2019 in Apache Spark by Gitika
• 41,080 points
1,489 views
0 votes
2 answers

Error : split value is not a member of org.apache.spark.sql.Row

var d=rdd2col.rdd.map(x=>x.split(",")) or val names=rd ...READ MORE

answered Aug 5 in Apache Spark by Ramkumar Ramasamy.
3,347 views
+1 vote
2 answers
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,950 points
6,061 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,950 points
923 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
38,876 views
0 votes
1 answer

Scala: 30: error: value partitions is not a member of String

Try this code: val rdd= sc.textFile (“file.txt”, 5) rdd.partitions.size Output ...READ MORE

answered Jul 29, 2019 in Apache Spark by Nijit
531 views
+1 vote
1 answer

How can I write a text file in HDFS not from an RDD, in Spark program?

Yes, you can go ahead and write ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,450 points
4,076 views